Commit Graph
48 Commits
Author SHA1 Message Date
Huan Du 76f1e16370 add sample to show how to build JOIN with Struct 2024-04-24 02:52:38 +08:00
maixl 145a39160f 移除ForeachReadForTag和ForeachWriteForTag函数 2023-11-02 08:28:25 +08:00
tianfw 9cd8ddcc2c support oracle 2023-08-27 21:18:36 +08:00
zhangyongding 455e7cda19 add func ForeachRead 2023-08-11 09:28:46 +08:00
zhangyongding e4c1e6d0e0 The ForeachRead function add isQuoted input parameters 2023-08-09 14:07:32 +08:00
zhangyongding 3c091eb813 add func for foreach tags 2023-08-08 11:07:34 +08:00
zhangyongding 096b0896e9 supports custom DBTag content 2023-07-25 09:13:42 +08:00
Huan Du 769091c858 refs #115: Generate SQL only when necessary values are set 2023-07-22 20:50:59 +08:00
Huan Du eb96df9e68 refs #100 add EXISTS/NOT EXISTS/ANY/SOME/ALL in Cond 2023-04-01 16:43:22 +08:00
Huan Du 42130d3b3a refs #60. more flexibility to filter fields with WithTag and WithoutTag in Struct 2023-02-27 00:59:49 +08:00
Spencer Connaughton 8880301f5b Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	README.md
#	args.go
#	flavor.go
#	insert_test.go
#	interpolate.go
#	interpolate_test.go
#	select_test.go
#	struct.go
#	struct_test.go
2023-01-05 10:19:05 -05:00
39a4b2509b Merge remote-tracking branch 'upstream/master' (#2)
* ignore unexported fields that are not embedded structs

* fix #74 [BREAKING CHANGE] Select#GroupBy and Select#OrderBy behavior change.

Previous, GroupBy and OrderBy only keep the columns in the last call. Now, all columns are kept.

* fix #75 add Struct#Columns/ColumnsForTag and Struct#Values/ValuesForTag

* remove a call to StructField.IsExported as it is not in go1.13

* refs #78 add new `fieldas` tag to set AS name for SELECT

* update docs

* fix #81 refactory struct field parser to make fieldas correct in all cases

* Add Gitter badge

* Fix insert ignore for postgres and sqlite.

* fix test

Co-authored-by: Michał Dobaczewski <[email protected]>
Co-authored-by: Huan Du <[email protected]>
Co-authored-by: The Gitter Badger <[email protected]>
Co-authored-by: Zhong Ren <[email protected]>
2022-11-30 10:57:35 -05:00
Huan Du 61a65cedc6 support driver.Valuer type in Struct and interpolate methods 2022-11-24 16:33:48 +08:00
Spencer ConnaughtonandGitHub 0f54cd520c Add CQL support (#1)
* Add CQL flavor.

* Add support for CQL argument compilation.

* Adopt substests for interpolation tests.

* Add support for CQL interpolation.

* Add support for CQL blobs.

https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/blob_r.html

* Add CQL timestamp interpolation support.

https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/timestamp_type_r.html

* Add builder test for CQL.

* Add support for the NOW function.

https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/timeuuid_functions_r.html?hl=now

* Add support for CQL update IF statement.

https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/cqlUpdate.html#Conditionallyupdatingcolumns

* Drop table prefixes for CQL SELECTs.

* Switch to single quoting for CQL queries.

https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/escape_char_r.html

* Update documentation.

* Use valid CQL in tests.

* Support CQL LIMIT.
2022-09-08 14:39:35 -04:00
Huan Du e6e16111d3 fix #81 refactory struct field parser to make fieldas correct in all cases 2022-09-04 00:09:09 +08:00
Huan Du 6592350faf update docs 2022-07-23 15:11:19 +08:00
Huan Du 72a87cb0b7 refs #78 add new fieldas tag to set AS name for SELECT 2022-07-21 22:14:43 +08:00
Huan Du 3dc5cbacd2 remove a call to StructField.IsExported as it is not in go1.13 2022-07-16 14:40:00 +08:00
Huan Du 0304f8a109 fix #75 add Struct#Columns/ColumnsForTag and Struct#Values/ValuesForTag 2022-06-25 15:07:58 +08:00
Aleksander Zaruczewski 157445026c Fix warnings and typos 2022-02-17 16:07:23 +03:00
Samuel El-BoraiandGitHub 3a39ac32e4 Fix small comment typo 2021-12-14 10:42:23 +01:00
Huan Du 1bb5856684 fix #65 Struct#InsertInto* methods are aware of omitempty options now 2021-07-25 15:34:47 +08:00
Huan Du 9d74991669 fix #59 support field mapper for Struct 2021-02-21 20:18:09 +08:00
Lluis Toyos 589248b9ed Fix Minor Error: just a return 2020-10-30 14:43:25 +01:00
Lluis Toyos 8dfc8a45ae Fix Error: tags now are trimmed 2020-10-30 13:10:21 +01:00
Lluis Toyos 29166060b1 refactor and Named Regex 2020-10-30 09:49:35 +01:00
Lluis Toyos 840ad7d339 changes suggested by Huan du 2020-10-29 17:40:23 +01:00
Lluis Toyos b14e260ce5 taking regex compile out from loop
- as noted by @scheca https://github.com/huandu/go-sqlbuilder/pull/50/files/f6e3b58d90b3bcb41a378a12c7679911e4b694b4#r511858689
2020-10-26 11:59:22 +01:00
Lluis Toyos f6e3b58d90 Fix fieldOptOmitEmptyForRegex 2020-10-26 09:52:10 +01:00
Lluis Toyos b129a95209 changes on struct.go for omitempty_for_tag behaviour 2020-10-24 13:37:29 +02:00
Huan Du 5a841c3555 refs #40. add table name as col prefix in Struct#SelectFrom/SelectFromTag 2019-11-21 14:46:19 +08:00
Huan Du 7e6b6f810c update doc 2019-11-11 16:55:43 +08:00
sunzheng 414da2d9ea refactory and rm useless code 2019-11-11 16:14:28 +08:00
sunzheng 728429d745 add replaceInto and replaceIntoForTag and its tests 2019-11-10 19:03:06 +08:00
sunzheng ddd5057cb7 add insert_ignore and insert_ignore_for_tag and its tests 2019-11-10 18:43:51 +08:00
Sergio Checa Blanco c8c78f7826 update struct with missing pointer values 2019-07-13 22:43:38 +02:00
Huan Du 015f032529 add a new fieldopt "omitempty" 2019-03-20 00:18:57 +08:00
Huan Du 1a61b6d200 fix #9. remove the limit set in Struct#SelectFrom. 2018-03-15 20:23:40 +08:00
Huan Du 7ad5c7dd9c use DefaultFlavor by default in NewStruct 2018-02-22 23:23:22 +08:00
Huan Du c5133ff161 support quote in Struct 2018-02-22 22:08:57 +08:00
Huan Du e219582f5a fix #6. support Postgre-flavor markers. 2018-02-04 21:49:42 +08:00
petersunbag 059b02a0f5 fix typo 2018-01-22 18:39:13 +08:00
petersunbag 47d4ff6365 clean code 2018-01-08 20:12:25 +08:00
petersunbag d89336ca7e InsertInto and InsertIntoForTag receive ...interface{} 2018-01-08 13:29:16 +08:00
petersunbag 9abfa340c3 struct bulk insert 2018-01-07 22:04:04 +08:00
Huan Du ff11beaf50 update doc 2017-12-31 01:57:03 +08:00
Huan Du 3d80e20960 update doc and provide more samples 2017-12-31 00:31:19 +08:00
Huan Du ae0151fccb implement Struct and add more docs 2017-12-30 04:36:25 +08:00