Commit Graph

365 Commits

Author SHA1 Message Date
Lunny Xiao 86775af2ec refactor and add setjson function (#1997)
Fix #1992

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1997
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-19 13:43:53 +08:00
Lunny Xiao aaa2111e8f Refactor asbytes (#1995)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1995
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-19 00:21:46 +08:00
Lunny Xiao 8bf97de140 Fix bug on dumptable (#1984)
Fix #1983

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1984
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-11 20:05:43 +08:00
Lunny Xiao 8f64a78cd4 Support delete with no bean (#1926)
Now you can use delete like this:

```
orm.Table("my_table").Where("id=?",1).Delete()
```

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1926
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-06 17:11:45 +08:00
Lunny Xiao d0e5dba40e Query interface (#1965)
refactor query interface

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1965
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-04 21:23:17 +08:00
Lunny Xiao 65846bacc3 Improve QueryString performance (#1962)
As title.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1962
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-02 11:25:20 +08:00
Lunny Xiao 8f8195a86b Improve get field value of bean (#1961)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1961
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-29 14:32:29 +08:00
Lunny Xiao 7fd6356a85 Add DBVersion (#1723)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1723
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 15:06:05 +08:00
Andrew Thornton d2f52eba64 Byte strings in postgres aren't 0x... (#1906)
Byte strings in postgres are actually E'\x...' not 0x...

This is part of the follow-up to #1872

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1906
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-09 15:09:59 +08:00
Andrew Thornton dab09c73ab Fix another bug with #1872 (#1905)
Ensure that structs, arrays and slices are properly converted to strings.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1905
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-08 21:39:03 +08:00
Andrew Thornton 210c30a7dd Fix two issues with dumptables (#1903)
There are two issues with #1872 which have become apparent
after testing on Gitea.

1. Ensure structs which are have before processors run correctly
2. Ensure structs extending other structs work
3. Ensure that numerical enums become numeric

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1903
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-08 12:27:22 +08:00
Andrew Thornton 912c2524f8 RFC: Use provided type to create the dstTable rather than inferring from the SQL types (#1872)
When using dumptables to convert between dialects if a struct is provided we should use it to generate the SQL types rather than infer them by mapping from the sql types.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1872
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-07 09:19:03 +08:00
Lunny Xiao 4bfe6853f5 Fix some comments lint and bug (#1888)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1888
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-10 10:57:36 +08:00
clannadxr eed7e65bd9 Panic when setting wrong logger (#1868)
Co-authored-by: clannadxr <clannadxr@hotmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1868
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: clannadxr <clannadxr@noreply.gitea.io>
Co-committed-by: clannadxr <clannadxr@noreply.gitea.io>
2021-02-18 17:14:13 +08:00
clannadxr 407da9ddd8 export tag identifier (#1865)
#1864 Export tag identifier so we can change that form `xorm` to others

This will be useful when in some migration scenarios such as migrate `sqlx` to `xorm`, the former uses `db` as the identifier and has a very simple rule which can be covered by xorm parser rules

Co-authored-by: clannadxr <clannadxr@hotmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1865
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: clannadxr <clannadxr@noreply.gitea.io>
Co-committed-by: clannadxr <clannadxr@noreply.gitea.io>
2021-02-09 15:20:54 +08:00
Lunny Xiao 4629bb1717 Add NewEngineWithDB (#1860)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1860
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-02-02 14:15:10 +08:00
Lunny Xiao b65276da85 Fix index (#1841)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1841
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-01-05 10:42:14 +08:00
jumpeiMano 17f28a1314 feat: define xorm.FromDialectAndDB (#1812)
refactor: rename the function name

feat: define xorm.FromDialectAndDB

Co-authored-by: jumpeiMano <jumpeim37@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1812
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-Authored-By: jumpeiMano <jumpeimano@noreply.gitea.io>
Co-Committed-By: jumpeiMano <jumpeimano@noreply.gitea.io>
2020-10-20 11:11:04 +08:00
MURAOKA Taro 56881e64a9 put ContextLogger in higher priority (#1656)
Merge branch 'master' into logger-priority

Merge branch 'master' into logger-priority

Merge branch 'master' into logger-priority

Merge branch 'master' into logger-priority

put ContextLogger in higher priority

SetLogger use `Logger` when give a interface which implements both
ContextLogger and Logger.  Because Go's type `switch` uses prior `case`.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: MURAOKA Taro <koron.kaoriya@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1656
2020-07-09 06:44:26 +00:00
Lunny Xiao 1a39682180 Fix dump of sqlite (#1639)
Fix test

fix test

Fix sqlite dump

Fix sqlite dump

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1639
2020-07-09 01:41:12 +00:00
Lunny Xiao 9b41b879a7 return the result on transaction (#1725)
return the result on transaction

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1725
2020-06-26 13:06:46 +00:00
Lunny Xiao 4dde8f14e6 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
limo.creed 34dc7f8791 Add Hook (#1644)
move hook to standalone package

add hook for engine

Co-authored-by: yuxiao.lu <yuxiao.lu@liulishuo.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1644
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-09 06:03:39 +00:00
Lunny Xiao 79bdda3cf1 Move all integrations tests to a standalone sub package (#1635)
Fix vet

Remove unused files

Move all integrations tests to a standalone sub package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1635
2020-03-27 07:13:04 +00:00
Lunny Xiao 78bb4c711d Improve codes (#1630)
Improve codes

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1630
2020-03-26 13:24:11 +00:00
Lunny Xiao b78418daa5 Support session id (#1632)
small nit

Support session id

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1632
2020-03-26 12:31:08 +00:00
Lunny Xiao fb8eb29d1e Fix lint errors (#1631)
Fix lint errors

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1631
2020-03-26 04:41:02 +00:00
Lunny Xiao 5053c35701 Don't keep db on dialects (#1623)
don't keep db on dialects

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1623
2020-03-24 02:19:24 +00:00
Lunny Xiao af30c17b0d Fix dump bug (#1613)
Fix dump

Fix dump bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1613
2020-03-21 16:05:12 +00:00
Lunny Xiao a7a1dc5c42 Fix setschema (#1606)
Fix schema

Fix setschema

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1606
2020-03-17 06:50:06 +00:00
Lunny Xiao b7b2b21a40 Fix dump/import bug (#1603)
Fix bug

Fix mssql

Fix postgres

Fix import test

Fix dump/import bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1603
2020-03-15 02:02:37 +00:00
Lunny Xiao c56c8e122a Fix master/slave bug (#1601)
fix test

Fix master/slave bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1601
2020-03-13 00:42:01 +00:00
Lunny Xiao 367b15879e Fix bug when dump (#1597)
Fix bug when dump

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1597
2020-03-11 23:30:35 +00:00
Lunny Xiao 537d82a6f7 Ignore schema when dbtype is not postgres (#1593)
Ignore schema when dbtype is not postgres

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1593
2020-03-10 13:15:18 +00:00
Lunny Xiao 00b65c6d99 Update README (#1582)
Remove version

Update README

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1582
2020-03-08 06:10:05 +00:00
Lunny Xiao 257653726e return sqls for create table (#1580)
return sqls for create table

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1580
2020-03-07 12:06:28 +00:00
Lunny Xiao ccf65397e8 Improve dialect interface (#1579)
Fix bug

Improve dialect interface

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1579
2020-03-07 10:00:05 +00:00
Lunny Xiao 7f22948be9 Improve dialect interface (#1578)
Improve dialect interface

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1578
2020-03-07 08:51:30 +00:00
Lunny Xiao 7455014823 Improve quote policy (#1567)
names with upper charactor on postgres will need quotes

Fix bug

Add new quote parameter on tests

Fix bug

Fix tests

Fix quotes

fix test

Improve quote policy

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1567
2020-03-06 07:48:32 +00:00
Lunny Xiao f51d28304a Move some codes to statement sub package (#1574)
revert change for delete

refactor new engine

fix tests

Move some codes to statement sub package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1574
2020-03-06 06:43:49 +00:00
Lunny Xiao 7278e2ab71 Improve tests (#1572)
fix test

Improve tests

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1572
2020-03-04 03:30:21 +00:00
Lunny Xiao b079bc05ff Add cockroach support and tests (#896)
Fix tests

fix some tests and ignore some

Add &experimental_serial_normalization=sql_sequence on test so that id will increase from 1

fix drone

Fix drone

Fix drone

Fix drone

Remove space

Add makefile

fix drone

fix drone

fix drone

update

fix tests

use sql_sequence when testing

fix postgres ci

fix circle ci for cockroach

upgrade cockroach version

add trace on error

add drone ci

run cockroach background

run cockroach backround

run cockroach backround

fix test

fix run cockroach

add cockroach test to circleci

add cockroach support

Add tests for table name (#1...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/896
2020-03-03 08:19:32 +00:00
Lunny Xiao 4e59597a49 Fix break session sql enable feature (#1566)
Fix break session sql enable feature

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1566
2020-03-01 03:05:26 +00:00
Lunny Xiao 41388c2f56 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 2b62dc5a51 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 f63b42ff9b 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 4c2b0e0f55 Add context for dialects (#1558)
More improvements

Add context for dialects

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1558
2020-02-27 15:31:05 +00:00
Lunny Xiao e2f9100419 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 aa522f7d98 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 02c8a4b25d 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