Commit graph

228 commits

Author SHA1 Message Date
Tobie Morgan Hitchcock
f33031ca6b Ensure doc tests compile successfully 2022-05-04 10:11:51 +01:00
Tobie Morgan Hitchcock
c5960a028e Improve comments in public library package 2022-05-04 00:49:38 +01:00
Tobie Morgan Hitchcock
65d0e3138a Ensure all necessary SQL types are publicly exported 2022-05-04 00:13:37 +01:00
Tobie Morgan Hitchcock
ffc3ed82f7 Simplify external API when working with Datastore 2022-05-04 00:07:46 +01:00
Tobie Morgan Hitchcock
6a8c53b51e Don’t use custom type definition for query responses 2022-05-03 17:47:47 +01:00
Tobie Morgan Hitchcock
01ab9375a3 Remove duplicate SQL string::substr() function 2022-05-02 23:22:22 +01:00
Tobie Morgan Hitchcock
0cbcb3b374 Simplify database query response object 2022-05-02 00:35:01 +01:00
Tobie Morgan Hitchcock
a4e07f693b Make certain functions private to crate 2022-05-01 23:25:53 +01:00
Tobie Morgan Hitchcock
1697beda9c No need to store the actual error on the executor 2022-05-01 10:35:26 +01:00
Tobie Morgan Hitchcock
d5fab4fbf0 Remove string::contains() SQL function 2022-04-30 21:47:19 +01:00
Tobie Morgan Hitchcock
355f1aac7b Don’t override context unnecessarily 2022-04-29 21:43:44 +01:00
Tobie Morgan Hitchcock
6f93c38cd2 Add SQL OUTSIDE operator for geometry types 2022-04-29 21:41:57 +01:00
Tobie Morgan Hitchcock
fb27185435 Remove unused import 2022-04-29 21:40:02 +01:00
Tobie Morgan Hitchcock
f5be6a3227 Remove unused time functions 2022-04-28 23:31:51 +01:00
Tobie Morgan Hitchcock
4c8d9dbb63 implement COLLATE and NUMERIC ordering in ORDER BY clauses 2022-04-27 16:21:51 +01:00
Tobie Morgan Hitchcock
4bc3b299aa Implement RAND() ordering in ORDER BY clauses 2022-04-27 02:30:26 +01:00
Tobie Morgan Hitchcock
e6fe7e675b Fix BEGIN / CANCEL / COMMIT full statements 2022-04-27 02:29:32 +01:00
Tobie Morgan Hitchcock
4275f93c57 Ensure random times are generated correctly 2022-04-24 12:03:17 +01:00
Tobie Morgan Hitchcock
8e283ecaeb Only check fields if the document is a table record 2022-04-13 18:31:28 +01:00
Tobie Morgan Hitchcock
cbdba0a117 Implement INDEX clauses 2022-04-09 13:33:39 +01:00
Tobie Morgan Hitchcock
f958eea305 Fix typo in ixdb key-value store implementation 2022-04-09 10:08:51 +01:00
Tobie Morgan Hitchcock
a41e52098b Improve performance of internal value conversion 2022-04-07 15:44:55 +01:00
Tobie Morgan Hitchcock
27a01bec08 Improve performance of embedded field path creation 2022-04-07 15:33:57 +01:00
Tobie Morgan Hitchcock
c4386f1549 Process PERMISSIONS clauses on document fields 2022-04-07 11:21:18 +01:00
Tobie Morgan Hitchcock
6b6d4f65f9 Process document fields correctly 2022-04-07 11:21:18 +01:00
Tobie Morgan Hitchcock
e378105f11 Add ‘every’ function on a value for field iteration 2022-04-07 11:21:18 +01:00
Tobie Morgan Hitchcock
9becf187f4 Add ‘each’ function on a value for field iteration 2022-04-07 11:12:10 +01:00
Tobie Morgan Hitchcock
285b83244c Remove PRIORITY clause from DEFINE FIELD statement 2022-04-07 08:38:47 +01:00
Tobie Morgan Hitchcock
2a0c8ddb4a Move duplicate code into dedicated functions 2022-04-07 08:35:39 +01:00
Tobie Morgan Hitchcock
f6b47d381b Ensure WHERE conditions are computed correctly 2022-04-06 20:28:16 +01:00
Tobie Morgan Hitchcock
2b89702490 Improve code comments 2022-04-06 20:15:56 +01:00
Tobie Morgan Hitchcock
2e2756d9e8 Implement INFO sql statements 2022-04-06 12:06:33 +01:00
Tobie Morgan Hitchcock
cf20cd4396 Treat $this param as a special case 2022-04-06 00:11:33 +01:00
Tobie Morgan Hitchcock
892fc99527 Implement EVENT clauses 2022-04-06 00:09:23 +01:00
Tobie Morgan Hitchcock
5df1040dd8 Implement PERMISSIONS clauses 2022-04-06 00:09:23 +01:00
Tobie Morgan Hitchcock
200741a35e Simplify &self in function definitions 2022-04-06 00:09:23 +01:00
Tobie Morgan Hitchcock
c1a128e7ab No need to clone key when fetching value on context 2022-04-06 00:09:23 +01:00
Tobie Morgan Hitchcock
aab4d0b096 Implement FIELD TYPE / VALUE / ASSERT clauses 2022-04-06 00:09:23 +01:00
Tobie Morgan Hitchcock
8980929a3c Ignore any errors when adding default NS / DB / TB 2022-04-04 23:24:39 +01:00
Tobie Morgan Hitchcock
64eedd413f Use consistent coding style 2022-04-04 23:23:31 +01:00
Tobie Morgan Hitchcock
b85e983ce7 Improve database TYPE clause definitions 2022-04-04 22:43:10 +01:00
Tobie Morgan Hitchcock
876a1e581e Simplify permissions definition and types 2022-04-04 22:37:16 +01:00
Tobie Morgan Hitchcock
664260ef0d Enable internal conversion between values 2022-04-04 22:34:46 +01:00
Tobie Morgan Hitchcock
2b7a23c569 Make DEFINE TABLE and DEFINE FIELD permissions FULL by default 2022-04-04 20:05:50 +01:00
Tobie Morgan Hitchcock
1d66a4772d Ensure correct ordering of values in datastore 2022-04-04 16:59:42 +01:00
Tobie Morgan Hitchcock
fd4752aff4 Add putc + delc functions for conditional put / del in kv store 2022-04-04 16:59:20 +01:00
Tobie Morgan Hitchcock
0df347732d Finish implementation of record storing / purging 2022-04-02 13:25:42 +01:00
Tobie Morgan Hitchcock
099e1d17ff Add common methods on document type 2022-04-02 13:23:45 +01:00
Tobie Morgan Hitchcock
b02ee12aaa Make code more legible 2022-04-02 13:22:53 +01:00
Tobie Morgan Hitchcock
94ffc054a7 Fix clippy warnings 2022-04-01 23:28:54 +01:00
Tobie Morgan Hitchcock
d6aadfecac Fix bug with datastore key bytes 2022-04-01 23:23:54 +01:00
Tobie Morgan Hitchcock
61c85e1c0f Only include parallel functions when enabled 2022-04-01 23:22:35 +01:00
Tobie Morgan Hitchcock
f3ade9b9d8 Update 3rd party dependencies 2022-04-01 22:06:03 +01:00
Tobie Morgan Hitchcock
2bf5075dc4 Fix bug with DEFINE and PERMISSIONS statement formatting 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
c45d383b77 Change name of OPTION statement options 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
c6c43aea8a Ensure OPTION IMPORT statement has opposite effect 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
4dea5c72ee Improve common function execution speed by inlining 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
bf1a833a79 Don’t set meta field on records 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
41c44ea709 Add runtime option for disabling permission checks 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
1ea692d32e Make code more consistent and simpler to read 2022-04-01 12:23:49 +01:00
Tobie Morgan Hitchcock
a938f017c4 Only allow OPTION statements to be run with KV/NS/DB auth levels 2022-04-01 09:20:44 +01:00
Tobie Morgan Hitchcock
7e51401ebb Make code more concise and simpler to read 2022-04-01 00:40:16 +01:00
Tobie Morgan Hitchcock
7e2eae32c5 Ensure query auth level checks are logically correct 2022-04-01 00:36:23 +01:00
Tobie Morgan Hitchcock
c57c313c47 Add function for checking if record already exists 2022-04-01 00:35:35 +01:00
Tobie Morgan Hitchcock
9f7527c01a Make simple value fetching functions synchronous 2022-03-25 21:15:55 +00:00
Tobie Morgan Hitchcock
2f033aa996 Remove unused functionality 2022-03-25 21:11:17 +00:00
Tobie Morgan Hitchcock
b3c4f982ec Fix clippy lint errors 2022-03-25 20:31:45 +00:00
Tobie Morgan Hitchcock
e92134c92d Ensure we can retrieve subsequent object fields 2022-03-25 18:45:14 +00:00
Tobie Morgan Hitchcock
87840e3e05 Implement GROUP BY clauses 2022-03-25 18:43:36 +00:00
Tobie Morgan Hitchcock
c2c25f68cf Change array manipulation function workings 2022-03-24 13:03:15 +00:00
Tobie Morgan Hitchcock
7e4bf91a48 Forbid all usage of unsafe code 2022-03-23 15:12:29 +00:00
Tobie Morgan Hitchcock
6017d424eb Implement FETCH clauses 2022-03-23 14:02:41 +00:00
Tobie Morgan Hitchcock
4c95db254a Add datastore key type for graph edges 2022-03-23 14:02:41 +00:00
Tobie Morgan Hitchcock
f674ea0544 Implement ORDER BY clauses 2022-03-23 14:02:41 +00:00
Tobie Morgan Hitchcock
3370b20c38 Only allow simple fields for SPLIT, ORDER, and GROUP clauses 2022-03-23 14:02:03 +00:00
Tobie Morgan Hitchcock
652195032c Implement SPLIT ON clauses 2022-03-23 14:02:02 +00:00
Tobie Morgan Hitchcock
0b3f4c5765 Prevent usize overflow when no records found 2022-03-23 12:05:50 +00:00
Tobie Morgan Hitchcock
5ae5046987 Implement REMOVE statements 2022-03-20 14:27:59 +00:00
Tobie Morgan Hitchcock
9778600304 Ensure all index data is removed when defining an index 2022-03-20 14:27:03 +00:00
Tobie Morgan Hitchcock
cb740dfcb0 Ensure transaction does not deadlock in DEFINE statements 2022-03-20 14:26:31 +00:00
Tobie Morgan Hitchcock
f8b747374f Pass the current statement to the value iterator functions 2022-03-18 19:51:13 +00:00
Tobie Morgan Hitchcock
5b1d727c25 Enable fetching WHERE clause from statement in iterator 2022-03-18 19:50:47 +00:00
Tobie Morgan Hitchcock
24752a75d9 Enable support for numbers and strings in record ids 2022-03-18 07:24:36 +00:00
Tobie Morgan Hitchcock
364412b437 Improve datastore key creation functionality 2022-03-18 07:21:22 +00:00
Tobie Morgan Hitchcock
f509b88109 Ensure upper range is included in a |test:1..10| model 2022-03-17 22:26:34 +00:00
Tobie Morgan Hitchcock
73df91a438 Use BigDecimal for large number handling 2022-03-17 21:55:32 +00:00
Tobie Morgan Hitchcock
5d554d07d3 Use char instead of str for parsing where possible 2022-03-16 23:53:31 +00:00
Tobie Morgan Hitchcock
97c0e50654 Parse numbers as either integers or decimals 2022-03-16 23:19:50 +00:00
Tobie Morgan Hitchcock
636eee4a25 Don’t treat all numbers as decimals unless necessary 2022-03-16 21:15:13 +00:00
Tobie Morgan Hitchcock
dc2b436131 Simplify common number parsing 2022-03-16 21:04:22 +00:00
Tobie Morgan Hitchcock
f13aafe576 Ensure numbers are parsed inside (bracket expressions) 2022-03-16 20:49:26 +00:00
Tobie Morgan Hitchcock
60c05ee082 Use hexadecimal u8 values when altering datastore keys 2022-03-16 17:01:25 +00:00
Tobie Morgan Hitchcock
336b2b92fc Fix failing build 2022-03-16 16:27:13 +00:00
Tobie Morgan Hitchcock
1b0477ae29 Ensure numbers are parsed properly
This change fixes a bug where `100test` would be parsed as a number, and the parser would subsequently fail. Now the value is only parsed as a number if it is immediately followed by an allowed character - otherwise it will fail, and the value `100test` will be parsed as an ident instead.
2022-03-16 15:50:08 +00:00
Tobie Morgan Hitchcock
f855e721e8 Update 3rd party dependencies 2022-03-16 15:48:01 +00:00
Tobie Morgan Hitchcock
232b35a304 Ensure numbers do not overflow numeric bounds 2022-03-16 15:40:26 +00:00
Tobie Morgan Hitchcock
cdef111786 Use u8 instead of char for datastpre key separators 2022-03-16 15:33:43 +00:00
Tobie Morgan Hitchcock
ba8dd7bd12 Use external storekey library for key encoding 2022-03-16 14:45:55 +00:00
Tobie Morgan Hitchcock
5781352058 Remove unused macros 2022-03-15 08:34:40 +00:00
Tobie Morgan Hitchcock
03af33796a Fix arithmetic and boolean binary expression order
Previously the expression operations happened right-to-left so `1 - 2 - 3 - 4 - 5` was actually calculated as `(1 - (2 - (3 - (4 - (5)))))`.  Now the expressions are calculated according to BODMAS, with boolean expressions calculated last.
2022-03-13 00:18:23 +00:00
Tobie Morgan Hitchcock
0f6d700f6b Implement initial logic for DEFINE statements 2022-03-07 18:15:57 +00:00
Tobie Morgan Hitchcock
64c02896dd Implement record storing and fetching 2022-03-07 18:11:44 +00:00
Tobie Morgan Hitchcock
438b1d759c Simplify datastore keys 2022-03-07 18:10:44 +00:00
Tobie Morgan Hitchcock
77844ab06b Convert error names according to clippy recommendations 2022-03-06 22:21:37 +00:00
Tobie Morgan Hitchcock
9444c550db Update 3rd party dependencies 2022-03-05 14:45:40 +00:00
Tobie Morgan Hitchcock
d1c2daaee4 Apply cargo clippy lint recommendations 2022-03-05 14:42:58 +00:00
Tobie Morgan Hitchcock
3154dc7bc8 Remove example usage in comments 2022-03-04 12:15:43 +00:00
Tobie Morgan Hitchcock
38c7ae206e Enable parallel iteration of records 2022-02-27 00:01:19 +00:00
Tobie Morgan Hitchcock
16da3e9b3b Improve performance of function processing 2022-02-26 20:25:07 +00:00
Tobie Morgan Hitchcock
ec698e85de Add keyword to queries for PARALLEL execution 2022-02-26 16:53:38 +00:00
Tobie Morgan Hitchcock
cd545c2edd Remove unused code 2022-02-26 15:09:30 +00:00
Tobie Morgan Hitchcock
b12a76c2ae Return &str instead of &String values 2022-02-26 00:35:11 +00:00
Tobie Morgan Hitchcock
63113f83c3 Ensure types can be serialized/deserialized to the datastore 2022-02-26 00:34:05 +00:00
Tobie Morgan Hitchcock
10c0b5c732 Check the context before processing values 2022-02-25 22:42:14 +00:00
Tobie Morgan Hitchcock
50e026f859 Remove unused datastore key 2022-02-25 16:53:17 +00:00
Tobie Morgan Hitchcock
f74a619474 Rename NU to NL and DU to DL for database keys 2022-02-23 17:15:49 +00:00
Tobie Morgan Hitchcock
1eddf94e8d Improve code and logic in iterator 2022-02-23 13:56:54 +00:00
Tobie Morgan Hitchcock
73879706a6 Improve debug and trace logging 2022-02-23 13:29:29 +00:00
Tobie Morgan Hitchcock
7f47fad02b Remove unimplemented script parsing functionality 2022-02-23 13:20:00 +00:00
Tobie Morgan Hitchcock
02d7154189 No need for explicit references 2022-02-23 11:21:06 +00:00
Tobie Morgan Hitchcock
7710451d7b Remove serde serialization field skipping
Due to a bug in msgpack-rust (https://github.com/3Hren/msgpack-rust/issues/86), in order to have correct serialization<->deserialization of data, we need to ensure all fields are serialized even when empty. This will affect the output size of the data, but will ensure that once serialized, the data is deserialized without issue.
2022-02-23 11:18:46 +00:00
Tobie Morgan Hitchcock
19909885e9 Remove old code comments 2022-02-22 19:08:40 +00:00
Tobie Morgan Hitchcock
7d5dc66555 Ensure we parse datetimes and durations in JSON requests 2022-02-22 19:08:22 +00:00
Tobie Morgan Hitchcock
d4566ff6ea Improve performance with query path analysis
Instead of creating a new Vec<_> for every embedded path part, we now use a reference when calling get/set/del on a value’s data. This means we aren’t creating and copying the Vec items each and every time we traverse down a path.
2022-02-22 19:05:58 +00:00
Tobie Morgan Hitchcock
cf707bf5e3 Remove crypto::bcrypt functions 2022-02-22 16:34:09 +00:00
Tobie Morgan Hitchcock
c28057f8ef Allow flat query expressions
Instead of having to specify [*] or * to get/set/del values in embedded arrays, it now supports access embedded values using a flat style for arrays.
2022-02-22 16:33:43 +00:00
Tobie Morgan Hitchcock
ca6974a5a8 Update code to remove geometry deprecation warnings 2022-02-22 16:30:02 +00:00
Tobie Morgan Hitchcock
d5c53b7791 Extract core surrealdb code into separate library 2022-02-22 14:16:50 +00:00