Commit Graph
68 Commits
Author SHA1 Message Date
zeekayandHanzo Dev d54045b5f0 Go 1.27.1, and the code it can say more simply
The module declares go 1.27.1. go fix applied the modernizers; omitzero
is not applied, since it changes what the JSON says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 19:56:19 -07:00
zeekay 7d0ad4da5d fork: xorm.io/xorm → github.com/hanzoai/xorm 2026-04-06 20:45:59 -07:00
Lunny Xiao 3699b62f47 Fix noautocond conflict with unscoped (#2559)
Replace #2418

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2559
2026-02-08 19:37:14 +00:00
Lunny Xiao 172d9452a6 Optimize find and count (#2552)
replace #2467

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2552
2026-02-08 00:14:29 +00:00
Lunny Xiao 1a3c9ee2db use golang ci lint v1 (#2551)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2551
2026-02-07 23:53:33 +00:00
Lunny Xiao 8c2132d511 Add lint and fix code (#2549)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2549
2026-02-07 18:40:04 +00:00
洪坤安andLunny Xiao 8c58c19159 Performance Optimization: reduce slice2Bean calling times of strings.ToLower and map creation times (#2255)
1. 优化性能:减少func (session *Session) slice2Bean方法中的strings.ToLower调用次数以及减少map创建和访问次数(见工单 https://gitea.com/xorm/xorm/issues/2243)

2. 新增SetDefaultJSONHandler方法,用于用户自行设置DefaultJSONHandler(见工单 https://gitea.com/xorm/xorm/issues/2129)

优化前:
加载耗时=16.079s,总记录数=4028940
加载耗时=15.775s,总记录数=4028940
加载耗时=15.946s,总记录数=4028940

优化后:
加载耗时=10.863s,总记录数=4028940
加载耗时=11.257s,总记录数=4028940
加载耗时=11.155s,总记录数=4028940

Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2255
Co-authored-by: 洪坤安 <[email protected]>
Co-committed-by: 洪坤安 <[email protected]>
2023-07-12 09:53:19 +00:00
Lunny Xiao 20dfc56352 Fix join problem (#2291)
Fix #2284

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2291
2023-07-12 02:01:56 +00:00
LinkinStarsandLunny Xiao 77c332d2f5 Filter support passing context (#2200) (#2270)
```diff
// Filter is an interface to filter SQL
type Filter interface {
---	Do(sql string) string
+++	Do(ctx context.Context, sql string) string
}
```

### Adds a `Context` parameter to the `Do` method of the Filter interface.

Developers can rewrite SQL through the `Filter` `Do` method and **need to get the necessary data from the Context** to assist.

For example, get user information through `Context`, so that different users can use different tables. Another example is to get the flags through `Context` to add annotations to the SQL, and use the annotations to let the subsequent `DB-Proxy` to achieve read/write separation.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2270
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: LinkinStars <[email protected]>
Co-committed-by: LinkinStars <[email protected]>
2023-05-31 01:43:24 +00:00
Lunny Xiao fb37d6de11 Refactor orderby and support arguments (#2150)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2150
2022-05-31 11:00:28 +08:00
0e9fa834ea fix reset colmap when counting distinct cols (#2096)
when using distinct cols with FindAndCount, reset statement.ColumnMap will make the counting sql an syntax error, this pr try fix this.
is this pr ok for merge?

error sql logging:
```sql
[SQL] SELECT DISTINCT `Fid` FROM `table_demo` WHERE Fkey = ? [val]

[SQL] SELECT count(DISTINCT ) FROM `table_demo` WHERE Fkey = ? [val]
```

after fix:
```sql
[SQL] SELECT DISTINCT `Fid` FROM `table_demo` WHERE Fkey = ? [val]

[SQL] SELECT count(DISTINCT `Fid`) FROM `table_demo` WHERE Fkey = ? [val]
```

Co-authored-by: finelog <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2096
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: finelog <[email protected]>
Co-committed-by: finelog <[email protected]>
2022-01-25 11:09:41 +08:00
Lunny Xiao c51ab47e49 Improve find interface (#2092)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2092
2022-01-06 19:43:06 +08:00
Lunny Xiao 90366b4317 Add README and fix some lints (#2079)
as title.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2079
2021-12-14 09:00:35 +08:00
Lunny Xiao c645cb8231 Refactor find (#2031)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2031
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-08-11 21:17:23 +08:00
Lunny Xiao bcf33c3cc1 Move convert back to xorm.io/xorm/convert (#2030)
Since `conversion.Conversion` has been referenced by external package, it should not be moved as internal package.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/2030
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-08-10 23:20:53 +08:00
Lunny Xiao 1c509afbb5 Move assign functions to convert package (#2015)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2015
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-07-28 15:15:35 +08:00
Lunny Xiao f169806bb0 refactor conversion (#2001)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2001
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-07-21 11:46:41 +08:00
Lunny Xiao 0217b00f81 refactor insert condition generation (#1998)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1998
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-07-20 13:46:24 +08:00
Lunny Xiao bdd2ccd892 refactor and add setjson function (#1997)
Fix #1992

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1997
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-07-19 13:43:53 +08:00
Lunny Xiao 8f6e175ac4 Refactor asbytes (#1995)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1995
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-07-19 00:21:46 +08:00
Lunny Xiao f42ae3555e refactor get (#1967)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1967
Co-authored-by: Lunny Xiao <[email protected]>
Co-committed-by: Lunny Xiao <[email protected]>
2021-07-06 16:06:04 +08:00
Lunny Xiao d883298462 Fix find and count bug with cols (#1826)
Fix find and count bug with cols

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1826
Co-Authored-By: Lunny Xiao <[email protected]>
Co-Committed-By: Lunny Xiao <[email protected]>
2020-11-09 12:23:14 +08:00
Lunny Xiao 6350f7a12a Fix find and count bug (#1651)
Fix bug

fix mssql findandcount

Fix find and count bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1651
2020-06-13 05:31:33 +00:00
Lunny Xiao 33e36cce16 Fix find with another struct (#1666)
Fix find with another struct

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1666
2020-04-26 11:34:05 +00:00
Lunny Xiao 066ca4224c Fix duplicated deleted condition on FindAndCount (#1619)
Fix duplicated deleted condition on FindAndCount

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1619
2020-03-24 00:48:54 +00:00
Lunny Xiao 6664cbad3f Fix find and count bug (#1618)
Fix find and count bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1618
2020-03-23 14:38:01 +00:00
Lunny Xiao d50168b346 Fix find alias bug (#1581)
Code improvement

Fix find alias bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1581
2020-03-08 02:29:25 +00:00
Lunny Xiao c08879c3ad Fix map with cols (#1575)
Fix cache bug

Fix map with cols

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1575
2020-03-06 08:55:12 +00:00
Lunny Xiao 2aba0fc46c Use a new ContextLogger interface to implement logger (#1557)
Fix bug

Add log track on prepare & tx

Some improvements

remove unused codes

refactor logger

Fix bug

log context

add ContextLogger interface

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1557
2020-02-29 08:59:59 +00:00
Lunny Xiao f4ed3b9330 Move statement as a sub package (#1564)
Fix test

Fix bug

Move statement as a sub package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1564
2020-02-28 12:29:08 +00:00
Lunny Xiao e87dc9ee24 Move maptype to tag parser (#1561)
Move maptype to tag parser

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1561
2020-02-28 02:00:21 +00:00
Lunny Xiao 946aa905dd Move tag parser related codes as a standalone sub package (#1547)
Fix sliceEq

fix tests

Move tag parser related codes as a standalone sub package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1547
2020-02-27 03:58:31 +00:00
Lunny Xiao a3902b8a38 Improve code (#1552)
Change filters

Fix test

add more tests on drone

add more tests on drone

Improve code

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1552
2020-02-27 03:33:40 +00:00
Lunny Xiao e8a782bcec Move caches to manager (#1553)
Move caches to manager

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1553
2020-02-27 03:12:25 +00:00
Lunny Xiao e736498221 Improve some codes (#1551)
Improve code

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1551
2020-02-27 01:30:06 +00:00
Lunny Xiao c772d044bd Move zero functions to a standalone package (#1548)
Remove depreciated functions and move some functions to schemas

Move zero functions to a standalone package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1548
2020-02-26 12:45:10 +00:00
Lunny Xiao 2a27b2bc79 Merge core package back into the main repository and split into serval sub packages. (#1543)
Fix test

Improve fmt

update go.mod

Move core as a sub package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1543
2020-02-24 08:53:18 +00:00
Lunny Xiao d447380a97 Fix int time deleted bug (#1539)
Fix panic

Fix test

Fix test for mssql time

Add sql type check on deleted cond

Fix int time deleted bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1539
2020-02-21 12:17:40 +00:00
e0185354d6 Fix slice of struct not cache bug (#895)
Fix failure caused by nil bean

Judge both type of struct and pointer in case of out-of-range

Fix issue #894

Add test for join subquery (#1528)

Fix test

Fix subquery with schema

Add test for join subquery

Add makefile (#1531)

Fix drone

Fix ci

Add deps

Improve drone

Fix envs

Add makefile

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1531

Add password for postgres drone image (#1530)

Add password for postgres drone image

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1530

format time when sqlTypeName is core.Varchar (#1026)

fix time test

add test for time format

sign codes according to contributing rules.

format time when sqlTypeName is core.Varchar. Same with core.DateTime or core.TimeStamp

Add test for second insert error (#1527)

Add test for second insert error

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1527

Add tests for table name (#1517)

add tests for table name

Fix test (#1526)

Fix test

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526

Fix test (#1526)

Fix test

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526

Fix wrong warning log on autoincrement column when sync table (#1525)

improve doc

Fix wrong warning log on autoincrement column when sync table

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1525

Fixed Join strings on func Exist (#1520)

fix test

fixed Join strings on func Exist

Co-authored-by: Tomofumi Kusana <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1520

For nullable columns, store nil values as NULL (#531)

Merge branch 'master' into jcsalem/fix/nil_ptr_is_nullable

fix bug when buffersize with iterate (#941)

Merge branch 'master' into lunny/fix_buffer_iterate

Exclude schema from index name (#1505)

Merge branch 'master' into fix-schema-idx

SetExpr support more go types (#1499)

Improve tests

SetExpr support more go types

fix vet

fix drone lint

remove go1.10 test on drone

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499

fix vet

fix drone lint

remove go1.10 test on drone

Exclude schema from the index name

Co-authored-by: Guillermo Prandi <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505

fix test

fix bug

fix bug when buffersize with iterate

SetExpr support more go types (#1499)

Improve tests

SetExpr support more go types

fix vet

fix drone lint

remove go1.10 test on drone

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499

fix vet

fix drone lint

remove go1.10 test on drone

Fix update with Alias (#1455)

Co-authored-by: Guillermo Prandi <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/941

fix update map with version (#1448)

fix test

fix update map with version

SetExpr support more go types (#1499)

Improve tests

SetExpr support more go types

fix vet

fix drone lint

remove go1.10 test on drone

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499

fix vet

fix drone lint

remove go1.10 test on drone

Fix update with Alias (#1455)

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448

Exclude schema from index name (#1505)

Merge branch 'master' into fix-schema-idx

SetExpr support more go types (#1499)

Improve tests

SetExpr support more go types

fix vet

fix drone lint

remove go1.10 test on drone

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499

fix vet

fix drone lint

remove go1.10 test on drone

Exclude schema from the index name

Co-authored-by: Guillermo Prandi <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505

SetExpr support more go types (#1499)

Improve tests

SetExpr support more go types

fix vet

fix drone lint

remove go1.10 test on drone

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499

For nullable columns, store nil values as NULL

fix vet

fix drone lint

remove go1.10 test on drone

Fix update with Alias (#1455)

Improve ci tests (#1477)

Rewrite Engine.QuoteTo() to accept multi-part identifiers (#1476)

Support local sql log (#1338)

Fix go mod and update version (#1460)

Move github.com/go-xorm/xorm to xorm.io/xorm (#1459)

add support custom type Nullfloat64 (#1450)

fix bug when query map condtion with no quote (#1449)

Don't warn when bool column default is 1 but not true (#1447)

* don't warn when bool column default is 1 but not true

* fix default case sensitive

Fix sync2 with custom table name (#1445)

* fix sync2 with custom table name

* fix bug on postgres

* fix bug on postgres

fix bug when update with setexpr (#1446)

add tidb tests on drone ci (#1444)

improve sync2 (#1443)

Fix wrong dbmetas (#1442)

* add tests for db metas

* add more tests

* fix bug on mssql

Fix default value parse bugs (#1437)

* fix default value

* fix default value tags

* fix postgres default

* fix default on postgres

* fix default on postgres

* fix mssql default

fix arg conversion (#1441)

* fix arg conversion

* fix bugs

* fix bug on postgres

* use traditional positional parameters on insert into select

* remove unnecessary tests

upgrade core (#1440)

add tests (#1439)
...

Co-authored-by: shanyy <[email protected]>
Co-authored-by: kusana <[email protected]>
Co-authored-by: Guillermo Prandi <[email protected]>
Co-authored-by: Guillermo Prandi <guillep2k@[email protected]>
Co-authored-by: yudppp <[email protected]>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/895
2020-02-21 05:18:08 +00:00
Lunny XiaoandGitea 29ddf99cce Move github.com/go-xorm/xorm to xorm.io/xorm (#1459) 2019-10-15 05:15:41 +00:00
Lunny XiaoandBetaCat a7d02852e2 fix bugs (#1375) 2019-07-30 16:35:36 +08:00
Lunny XiaoandGitHub d58111aa2c move depends package from github.com to customize domain (#1327) 2019-06-17 13:38:13 +08:00
Lunny XiaoandGitHub 14ce3e7fb0 Add lasterror on statement to return errors when chain operations (#1151)
* add lasterror on statement to return errors when chain operations

* add tests for last error

* refactor error
2019-01-20 11:45:42 +08:00
Slory7andLunny Xiao d3004df3c5 fix session_find & session_get getCacher param error (#1131)
* fix session_delete getCacher tablename param error

* fix session_find & session_get getCacher  param error
2018-11-03 00:17:11 +08:00
Lunny XiaoandGitHub 8189888851 fix #997 group by (#1065) 2018-08-09 14:37:44 +08:00
Lunny XiaoandGitHub fd7e36d59d fix update map with table name (#888)
* fix update map with table name

* fix bug update map when cache enabled

* refactor cacheInsert

* fix cache test
2018-04-11 23:09:46 +08:00
Lunny XiaoandGitHub 28be7bc422 fix tablename bug (#887)
* fix tablename bug

* fix test
2018-04-11 18:09:16 +08:00
Lunny XiaoandGitHub 47ec43508a Add test for count with orderby and limit (#880)
* add test for count with orderby and limit

* fix the bug
2018-04-10 12:52:47 +08:00
Lunny XiaoandGitHub d4175d36bf fix findandcount bug with order (#869) 2018-03-26 10:25:39 +08:00
Lunny XiaoandGitHub ddf7daaeb1 fix findandcount bug (#853) 2018-02-24 17:08:34 +08:00