1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
Commit Graph

104 Commits

Author SHA1 Message Date
aa61fcb3dc orm: fix inserting sequential values (id=0), in tables with an i64 primary field (#18791) 2023-07-05 23:25:22 +03:00
f0fb86f76e checker,orm: skip compile-time error msg for fields tagged with [skip] and [sql: '-'] (#18700) 2023-06-29 06:43:24 +03:00
6ac09e605e orm: allow structs without the id field, more flexible primary keys (#18140) 2023-05-09 00:21:42 +03:00
40a97aed1a docs, orm: update examples (#18106) 2023-05-03 20:33:16 +03:00
5631e2f01d ci,cgen,orm: fix CI failures after 9f118ba 2023-05-02 21:29:58 +03:00
9f118ba3f1 orm: skip via the "-" attribute 2023-05-02 17:00:54 +02:00
ca2820da5f checker, orm: don't insert an uninitialized struct in the related table. (#18093) 2023-05-02 11:14:42 +03:00
3fb32a866c all: like operator/keyword for V ORM (#18020) 2023-04-23 03:40:54 +03:00
8452644ec3 orm: enforce that queries always return a Result, a query-resulting array can be used as a V array in place. (#17871) 2023-04-04 08:23:06 +03:00
db97630117 examples, orm: fix orm example; add -d trace_orm option to see all ORM generated queries (#17770)
* orm: add tracing of the generated queries by the orm module, when a program is compiled with `-d trace_orm`

* examples: fix examples/database/orm.v, add comments, and ensure that the example can be run several times with no errors

The example demonstrates connecting to all 3 DBs in the same program, and will be added to the CI very soon,
to serve both as a regression test, if it fails, and as an example to how to use the ORM in combination with
raw SQL queries to the DBs (which are driver/wrapper specific, unlike the ORM, but can be more convenient in some situations).
2023-03-25 21:46:17 +02:00
d0e78b1da6 parser: breaking change, let V ORM queries return arrays for *all* non-count queries, including limit = 1 (#17719) 2023-03-22 09:48:01 +02:00
9e7aeec215 sql: fix wrong field name on generated code (#17684) 2023-03-17 21:45:52 +01:00
3682a9cf88 orm: allow use of mut db orm.Connection (#17439) 2023-03-01 00:49:30 +02:00
b7b6c2368e orm: allow using connections, that were explicitly casted to orm.Connection too (#17427) 2023-02-27 23:54:03 +02:00
580dbc3f0e orm: allow inserting empty objects with db.sqlite (SQLite uses a slightly different SQL dialect) (#17334) 2023-02-16 11:34:16 +02:00
5d4c9dc9fc checker: allow using struct field as ORM limit and offset. (#17330) 2023-02-15 19:47:35 +02:00
03be525c82 orm: allow using reference objects in ORM insert. (#17279) 2023-02-11 10:02:55 +02:00
d563739264 checker: add type checking for ORM limit, offset, and order by. (#17095) 2023-01-31 10:22:02 +02:00
4747e70d9d orm: make last_id() return int, instead of orm.Primitive (fix #12110) (#17151) 2023-01-29 16:00:23 +02:00
9a86456365 cgen: support string interpolation in ORM queries (#17141) 2023-01-29 01:27:34 +02:00
a9a04bba55 orm: support fn calls in where (#17127) 2023-01-26 22:36:30 +02:00
2fb9bdce9a cgen, checker: add panic in ORM for invalid queries, when there are no or {} blocks, add type checking for the fkey attribute, add tests (#16977) 2023-01-17 20:21:10 +02:00
64558df764 vlib: move the mysql/sqlite/pg/mssql modules under vlib/db (#16820) 2023-01-13 17:02:32 +02:00
1ba1f99b9c orm: declare missing functions to handle literal types (#16627) 2022-12-09 20:34:34 +02:00
458e68e196 orm,sqlite,mysql,pg: cleanup import v.ast, using typeof[Type]() 2022-12-07 13:40:46 +02:00
ada8643ac5 checker: disallow using builtin type names for const names (#16599) 2022-12-06 15:44:25 +02:00
017ace6ea7 vfmt: change all '$expr' to '${expr}' (#16428) 2022-11-15 16:53:13 +03:00
f427a5241a os,tools: add os.vtmp_dir()
Use it to consistently place all temporary files created by tests in a overridable folder specific to the user, that is easy to cleanup later.

NOTE: os.temp_dir() on macos returns `/tmp`, and using `/tmp/v` is a problem when multiple unix users are trying to access/create/write to it.
2022-11-03 10:19:51 +02:00
992b502198 db, json, time, term: change optional to result (#16201) 2022-10-26 11:26:28 +03:00
41dbd12bc4 tests: make error handling the same as the main function (#15825) 2022-09-21 19:45:43 +03:00
f922ed0941 tests: unify all temporary files/folders under $VTMP/v, that can be cleaned by v wipe-cache (#15774) 2022-09-16 04:56:19 +03:00
f249feb9da orm: support parenthesized expressions as in select from User where (name == 'Sam' && is_customer == true) || id == 1 (#15693) 2022-09-09 21:08:48 +03:00
95a328be98 orm: improve the README and the tests. Add an error message for foreign key tags (#15670) 2022-09-06 13:12:37 +03:00
6110373519 orm: init or implementation (#14989) 2022-08-31 14:43:20 +03:00
095f4bcf86 orm: add missing 'nonull' attribute description (#15348) 2022-08-05 10:27:19 +03:00
e5e750d533 orm: default attribute (#15221) 2022-07-27 00:59:32 +03:00
a13b8ff0c8 mysql: fix for adapting mysql types to v structs (#15100) 2022-07-19 18:29:09 +03:00
3f3742122f orm: sql type in struct by attribute (#14919) 2022-07-13 18:03:30 +03:00
d4b0ebf215 doc: clear the explanation to 'sql: type' (#14915) 2022-07-09 14:04:35 +03:00
a46bcf3571 all: v.ast.byte_type -> v.ast.u8_type (#14964) 2022-07-06 13:32:30 +03:00
5df3d8ac75 orm: mysql fixes (#14772) 2022-06-16 20:19:49 +03:00
a83ac948a0 orm: document & fix pg (#14533) 2022-05-26 22:53:09 +03:00
d679146a80 fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
af73e195da net: byte fixes 2022-04-15 15:55:39 +03:00
36ec47cd20 all: replace "NB:" with "Note:" (docs/comments) 2022-03-06 20:01:22 +03:00
fa2de89db9 orm: do not order by default, ordering is slow; also fix a bug for tables without defined primary keys 2021-12-23 16:43:22 +02:00
d33f7d12f7 orm: fix time struct in sql stmt (#12298) 2021-10-28 22:31:41 +03:00
8d5931c96c orm: fix a typo (#12131) 2021-10-10 03:47:35 +03:00
4a6d161c08 orm: postgres fixes 2021-09-30 20:00:27 +03:00
6391f3d2da orm: fix other int types (#11981) 2021-09-26 11:17:56 +03:00