finelog
e5c89cf55e
fix panic when convert sql and args with nil time.Time pointer ( #2038 )
...
this pr fix a panic, when using nil time.Time pointer for input.
not sure if there are others similar code.
please review it, thanks!
Co-authored-by: finelog <kaicltw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2038
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: finelog <finelog@noreply.gitea.io>
Co-committed-by: finelog <finelog@noreply.gitea.io>
2021-08-26 00:03:18 +08:00
Lunny Xiao
0a429a241d
Drop sync function and rename sync2 to sync ( #2018 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2018
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-24 17:13:17 +08:00
Lunny Xiao
d92fb412ee
Make Get and Rows.Scan accept multiple parameters ( #2029 )
...
Now the below behaviours are allowed.
```Go
var id int64
var name string
has, err := engine.Table(&user).Cols("id", "name").Get(&id, &name)
// SELECT id, name FROM user LIMIT 1
```
```Go
rows, err := engine.Cols("name", "age").Rows(&User{Name:name})
// SELECT * FROM user
defer rows.Close()
for rows.Next() {
var name string
var age int
err = rows.Scan(&name, &age)
}
```
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2029
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-24 15:42:34 +08:00
Lunny Xiao
c29b9649a9
Add dameng support ( #2007 )
...
driver: https://gitee.com/travelliu/dm
docker: https://download.dameng.com/eco/dm8/dm8_docker.tar
fix #1837
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2007
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-24 13:46:08 +08:00
yedf
7cd6a74c9f
expose sql.Tx ( #2036 )
...
Co-authored-by: yedongfu <dongfuye@163.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2036
Co-authored-by: yedf <yedf@noreply.gitea.io>
Co-committed-by: yedf <yedf@noreply.gitea.io>
2021-08-21 11:30:31 +08:00
Lunny Xiao
7d458b4fcf
refactor create table for postgres ( #2034 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2034
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-14 10:57:47 +08:00
Lunny Xiao
dbc2de380b
Refactor find ( #2031 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2031
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-11 21:17:23 +08:00
Lunny Xiao
289c27ebec
add changelog for 1.2.2
2021-08-11 09:29:27 +08:00
Lunny Xiao
cace6862e2
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 <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-10 23:20:53 +08:00
Lunny Xiao
fae164488c
Fix problem on README ( #2028 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2028
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-08 15:35:44 +08:00
Lunny Xiao
3a8ae761c5
Add changelog for v1.2.1
2021-08-08 11:01:02 +08:00
Lunny Xiao
ad1a386b5e
Fix wrong comment ( #2027 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2027
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-08 11:00:11 +08:00
Lunny Xiao
4499c8c5b5
Fix import file bug ( #2025 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2025
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-06 11:26:22 +08:00
Lunny Xiao
bd1ca33ea5
Update docs for pgx ( #2024 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2024
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-05 14:47:25 +08:00
Lunny Xiao
0b3cc25a10
Add pgx driver support ( #1795 )
...
Fix #858
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1795
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-05 14:04:11 +08:00
Lunny Xiao
42c2f158e8
Fix timesatmp ( #2021 )
...
Now `Datetime` support `Datime(6)` to indicate the time scale. For different database , the max scale is not different.
`Datetime` means `Datetime(0)`.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2021
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-08-04 16:12:10 +08:00
Lunny Xiao
f22b0cc369
Update changelog for 1.2.0
2021-08-04 09:20:54 +08:00
Lunny Xiao
2afa222871
Fix deleted column ( #2014 )
...
Fix #2013
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2014
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-29 19:51:10 +08:00
Lunny Xiao
aeed22016f
Support batch insert map ( #2019 )
...
Fix #1767
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2019
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-29 16:12:09 +08:00
Lunny Xiao
4383669bcd
Fix DBMetas returned unsigned tinyint ( #2017 )
...
Fix #2011
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2017
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-29 11:04:43 +08:00
Lunny Xiao
5240459858
Move assign functions to convert package ( #2015 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2015
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-28 15:15:35 +08:00
Lunny Xiao
eb6d3b1637
Make drone faster ( #2008 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2008
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-28 11:41:58 +08:00
Lunny Xiao
c02a1bf00c
Fix postgres driver datasource name parse ( #2012 )
...
Fix #2010
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2012
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-28 10:03:09 +08:00
Andrew Thornton
d973423802
Fix issue with byte representation in MSSQL ( #1957 )
...
There is a missing cast to string in BuildUpdates which leads to a failure
to call str2ucs and ucs2str for converts on MSSQL.
Ref: https://github.com/go-gitea/gitea/issues/16252
Signed-off-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1957
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-07-23 09:01:49 +08:00
Andrew Thornton
ad4830f531
Remove default length of 50 for Blob ( #1959 )
...
There is an odd inconsistency with default blob sizes - this PR only sets the
default size for bytea and binary.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1959
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-07-23 08:59:53 +08:00
Lunny Xiao
6f79e06376
Fix master/slave bug ( #2004 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2004
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-22 11:07:53 +08:00
Lunny Xiao
47cfe0347f
Add test for limit with query ( #1787 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1787
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 21:13:15 +08:00
Lunny Xiao
0f3f4ea7fb
Update docs ( #2003 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2003
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 19:17:50 +08:00
Lunny Xiao
107bee4eb4
refactor conversion ( #2001 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2001
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 11:46:41 +08:00
Lunny Xiao
e323971011
refactor some code ( #2000 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2000
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-21 00:12:20 +08:00
Lunny Xiao
a7e010df2d
refactor insert condition generation ( #1998 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1998
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-20 13:46:24 +08:00
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
raizen666
5950824e37
Support build flag go-json to replace default json ( #1982 )
...
`go build -tags=gojson` to use `github.com/goccy/go-json` as default json handler
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1982
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: raizen666 <raizen666@noreply.gitea.io>
Co-committed-by: raizen666 <raizen666@noreply.gitea.io>
2021-07-19 12:49:50 +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
779a74ccff
Remove duplicated code ( #1991 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1991
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-15 07:06:15 +08:00
Lunny Xiao
69a7db5312
improve uint tests ( #1990 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1990
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-14 17:06:53 +08:00
Lunny Xiao
b296c8f1d7
Exec with time arg now will obey time zone settings on engine ( #1989 )
...
Fix #1770
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1989
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-14 12:20:26 +08:00
andreasgerstmayr
147328f629
fix possible null dereference in internal/statements/query.go ( #1988 )
...
Make sure that pLimitN is not `nil` before dereferencing the pointer.
Co-authored-by: Andreas Gerstmayr <agerstmayr@redhat.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1988
Co-authored-by: andreasgerstmayr <andreasgerstmayr@noreply.gitea.io>
Co-committed-by: andreasgerstmayr <andreasgerstmayr@noreply.gitea.io>
2021-07-12 23:51:50 +08:00
Lunny Xiao
394c4e1f17
Replace #1044 ( #1935 )
...
Fix #1372 , #765
TODO:
- [x] Add tests
Co-authored-by: MURAOKA Taro <koron.kaoriya@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1935
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-11 21:33:01 +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
6f46e68425
Support Get time.Time ( #1933 )
...
Fix #1107
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1933
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-11 09:30:33 +08:00
Lunny Xiao
dbd45f3f8e
set test timeout 20m ( #1985 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1985
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-10 23:27:55 +08:00
Lunny Xiao
27b1736c57
Add test for get map with NULL column ( #1948 )
...
Add tests for #1824
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1948
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 19:16:36 +08:00
Lunny Xiao
375857b4be
Add benchmark tests ( #1978 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1978
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 18:17:47 +08:00
Lunny Xiao
717e4a0d21
Add database alias table and fix wrong warning ( #1947 )
...
fix #1831
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1947
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 17:09:40 +08:00
Lunny Xiao
a38b1fddb3
Add tests for github.com/shopspring/decimal support ( #1977 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1977
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 17:00:58 +08:00
Lunny Xiao
46fd8f58b3
Get struct and Find support big.Float ( #1976 )
...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1976
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 15:46:21 +08:00
Lunny Xiao
b754e78269
Support big.Float ( #1973 )
...
Now you can use big.Float for numeric type.
```go
type MyMoney struct {
Id int64
Money big.Float `xorm:"numeric(22,2)"`
}
```
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1973
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 14:00:16 +08:00
Lunny Xiao
54bbead2be
refactor slice2Bean 2 ( #1975 )
...
as title.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1975
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 13:59:48 +08:00
Lunny Xiao
bece9a6373
refactor slice2Bean ( #1974 )
...
as title.
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1974
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-07 13:03:05 +08:00