1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-05 14:00:54 +00:00
Commit Graph

380 Commits

Author SHA1 Message Date
“fudali113”
f471ee9025 update orm_test 2016-07-26 12:19:06 +08:00
“fudali113”
182a21172f Optimize the code logic 2016-07-26 11:15:59 +08:00
“fudali113”
bf17558d06 update “modification hardcode 2 2016-07-22 12:25:30 +08:00
“fudali113”
e0e888ab8f update “modification hardcode 2016-07-22 12:10:37 +08:00
“fudali113”
3583ad8cc0 update annotation 2016-07-21 15:49:55 +08:00
“fudali113”
e2316c4b9e update 2016-07-20 17:28:26 +08:00
“fudali113”
6d1b203bca update 2016-07-20 16:52:14 +08:00
“fudali113”
50c5df32b1 update 2016-07-20 16:26:02 +08:00
“fudali113”
530c32017c update 2016-07-20 15:33:30 +08:00
“fudali113”
ec521ad166 update 2016-07-20 15:13:18 +08:00
“fudali113”
4b8ecced83 orm insert or update 2016-07-20 14:37:05 +08:00
Victor Popkov
415b9cf310 add support for time.Time pointer in struct types
Allow to use pointer *time.Time as a type in combination with orm tags in struct. This enables to treat them as "empty" in JSON marshaling/unmarshaling when using 'json:"null,omitempty'.
2016-06-22 16:57:05 +03:00
ysqi
3f016840db fixed test error 2016-06-04 10:41:55 +08:00
ysqi
d528fafd43 ignore case of tag and fixed bug for columName 2016-06-03 22:06:43 +08:00
wy65701436
d4d7621942 modify the error log for registerModel to tell user the default hard code PK is 'id'. 2016-05-27 02:03:58 -07:00
qAison
761b6c129c count func add support group by 2016-05-27 14:34:45 +08:00
qAison
8f0749ddee fix fk field null value 2016-05-27 13:53:28 +08:00
wincss
a4d4b8de77 fix #1936 2016-05-10 17:45:06 +08:00
astaxie
520a417cca Merge pull request #1874 from Maxgis/master
change limit 1000 to 1,reduce the amount the data
2016-04-26 09:56:44 +08:00
maxin[马鑫]
56dc9bf622 add return ErrMultiRows 2016-04-25 15:51:12 +08:00
maxin[马鑫]
9ce6dc4cdf remove test ; because rows are returned in an unspecified order 2016-04-13 21:04:46 +08:00
miraclesu
903e21bef2 orm: add test case for InsertMulti 2016-04-13 20:22:27 +08:00
miraclesu
3a3f70027c orm: fix panic multi insert when slice lenght is 1 & the value is pointer 2016-04-13 20:14:02 +08:00
maxin[马鑫]
81c6c898cf remove orm one function thorw ErrMultiRows error 2016-04-13 10:36:12 +08:00
maxin[马鑫]
9679f5e22a reduce the data transmission 2016-04-12 21:28:29 +08:00
miraclesu
5185816942 orm: use text as postgres default type 2016-04-12 21:19:43 +08:00
miraclesu
99f1e6c8b5 orm: fix golint 2016-04-12 11:00:31 +08:00
miraclesu
e95bef1331 orm: add test case for json & jsonb type support 2016-04-12 11:00:31 +08:00
miraclesu
657744efb1 orm: add json & jsonb type support 2016-04-12 11:00:31 +08:00
maxin[马鑫]
553078d956 change limit 1000 to 1,reduce the amount the data 2016-04-11 09:02:22 +05:30
Ivan Cadri
d49c7f96cb added functionality for column type time
updated the model_fields to cater for the time field type
2016-04-03 16:58:19 +02:00
miraclesu
1794c52d65 orm: fix postgres sequence value 2016-03-27 15:06:57 +08:00
miraclesu
3ca44071e6 orm: insert specified values for insertMulti 2016-03-26 21:51:05 +08:00
miraclesu
e0a36fb61e Merge branch 'develop' into feature/orm_auto 2016-03-26 21:16:52 +08:00
miraclesu
3e2ffa545f orm: fix postgres returning id error 2016-03-24 20:03:45 +08:00
miraclesu
eaf38bb096 orm: add test case for uint pk read or create 2016-03-23 21:59:09 +08:00
miraclesu
3be6688cd1 orm: fix painc when pk is uint on ReadOrCreate 2016-03-23 21:57:57 +08:00
miraclesu
8f70df6c7b orm: add test case for insert specified value to auto field 2016-03-23 20:28:22 +08:00
miraclesu
1786b16e61 orm: support insert a specified value to auto field 2016-03-23 20:16:18 +08:00
astaxie
ba7a809de8 Merge pull request #1810 from miraclesu/fix/orm_miss_pk
orm: fix miss pk when pk is negative
2016-03-22 10:09:35 +08:00
miraclesu
84ae930c64 orm: Add test case for integer pk 2016-03-18 21:58:11 +08:00
miraclesu
a3d4218d9d orm: fix miss pk when pk is negative 2016-03-17 21:41:35 +08:00
JessonChan
ec35bd0c28 orm log header flag 2016-03-16 18:04:27 +08:00
miraclesu
dcfcb2789e orm: inline struct relate test case 2016-03-13 21:04:39 +08:00
astaxie
1f0a65f0a2 fix the orm test 2016-03-10 22:21:21 +08:00
astaxie
31f7524dae fix the golint travis 2016-03-10 21:47:50 +08:00
astaxie
3a12e238cc support oracle 2016-03-10 21:23:13 +08:00
miraclesu
64e0858d44 orm: add inline struct test case 2016-03-08 22:24:38 +08:00
miraclesu
85f55fcb41 orm: inline struct support 2016-02-24 18:46:14 +08:00
astaxie
441f795a1a Merge pull request #1651 from thanhtranjs/develop
Add GroupBy to QuerySeter
2016-02-02 12:44:49 +08:00
Thanh Tran
bb50383aa9 Add GroupBy to QuerySeter 2016-02-02 11:28:43 +07:00
astaxie
fdce4af9c8 fix #1619 2016-01-25 20:53:52 +08:00
astaxie
f925bb9058 golint all the files 2016-01-18 00:18:21 +08:00
astaxie
90d1349665 fix typo 2016-01-17 23:48:17 +08:00
astaxie
a304bb9c25 Revert "add test case for tidb"
This reverts commit f70d2cc373.
2016-01-17 18:35:11 +08:00
astaxie
f70d2cc373 add test case for tidb 2016-01-17 18:24:29 +08:00
astaxie
797571c85f fix the ORM test case 2016-01-15 14:36:45 +08:00
astaxie
a069c73b3a test case bool default value is true 2016-01-15 14:02:08 +08:00
astaxie
7dbeb2c39a fix the default value 2016-01-15 08:43:02 +08:00
astaxie
4375ca84d1 fix the sqlite m2m 2016-01-14 23:49:28 +08:00
astaxie
fd608d2bf6 disable tidb testing 2016-01-08 19:59:20 +08:00
astaxie
7fbaf82897 fix #1424 2016-01-04 22:10:18 +08:00
fud
92711e80a3 refactor controller.go 2015-12-21 16:23:31 +08:00
astaxie
a4f674e7f4 Merge pull request #1483 from nkbai/develop
为orm接口添加注释
2015-12-17 22:23:32 +08:00
astaxie
e5096be32b Merge pull request #1490 from pjoe/orm_pk_rel_many
Fix joins for reverse(many) with custom pk
2015-12-17 14:56:06 +08:00
Pelle Johnsen
906637ae8b Fix issue with reverse(many) for models with custom pk
- Also add test covering the issue
2015-12-15 17:39:08 +01:00
nkbai
3daaaeb32b add commit for orm/types.go 2015-12-15 19:48:28 +08:00
nkbai
b079456fcf add comments for orm/types.go 2015-12-14 15:04:17 +08:00
astaxie
ed99c013a6 Revert "Update orm_querym2m.go" 2015-12-02 16:35:36 +08:00
astaxie
a1d5f958c5 Merge pull request #1464 from gobenon/master
Update orm_querym2m.go
2015-12-02 16:35:05 +08:00
gobenon
50f8f3bd20 Update orm_querym2m.go 2015-11-30 18:23:58 +02:00
astaxie
2c94d9eab2 Merge pull request #1451 from gobenon/master
fix issue 1438 opened by Ayelet Regev
2015-11-25 09:29:28 +08:00
gobenon
efd30bdba7 Update orm_querym2m.go 2015-11-19 16:46:14 +02:00
gobenon
ca37557a26 Update orm_querym2m.go 2015-11-19 14:30:14 +02:00
astaxie
25bec8bbe9 Merge pull request #1381 from ADone/m2m_reverse_bug
fix #671
2015-11-04 23:20:22 +08:00
astaxie
a257a924a1 Merge pull request #1379 from pjoe/non_int_fk
orm: Fix handling of rel(fk) to model with string pk
2015-11-04 22:26:33 +08:00
Pelle Johnsen
174e758d19 Fix dbBase.Update not returning error 2015-09-28 14:07:35 +02:00
Pelle Johnsen
cfcce4f5dc Fix handling of rel(fk) to model with string pk 2015-09-22 12:23:51 +02:00
astaxie
4823a0f114 remove the dead code 2015-09-17 23:47:26 +08:00
astaxie
3df0fa462d golint tidb 2015-09-17 23:00:05 +08:00
ngaut
09b7457ac6 orm_test: Skip relation test 2015-09-17 17:05:40 +08:00
ngaut
c841a77ad6 Orm: Add tidb for query builder 2015-09-17 17:04:23 +08:00
ngaut
c73e0395ed Orm: Support TiDB 2015-09-17 17:04:23 +08:00
astaxie
68ec133aa8 golint orm 2015-09-12 21:46:43 +08:00
f0r
a074df9c2e 为querySeter添加GroupBy方法 2015-09-03 00:45:09 +08:00
Pelle Johnsen
0c33673197 Revert spaces > tabs change 2015-08-24 09:41:10 +02:00
Pelle Johnsen
19d82ab62c Fix #1274: Add QuerySeter.Distinct() 2015-07-22 18:12:57 +02:00
Artem Nistratov
5612f61a93 fix #671 2015-07-08 17:42:00 +03:00
空见
bbb6f31f16 support eq&ne for orm 2015-06-09 10:18:21 +08:00
Trần Văn Thanh
0222b8d693 fixed: when RelatedSel have multi string/relation, it only get last string 2015-05-25 09:10:36 +08:00
astaxie
1d8afdc9c9 gofmt -s & go_vet 2015-05-25 09:10:34 +08:00
astaxie
020bfbcc9c Merge branch 'develop' 2015-02-27 22:47:59 +08:00
astaxie
6d313aa15f fix #985 2015-02-27 22:37:41 +08:00
astaxie
433e8f2ce3 Revert "Add GroupBy to QuerySeter" 2015-02-14 20:40:43 +08:00
astaxie
22ba7fdce4 Merge pull request #1000 from pdf/group_by_queryseter
Add GroupBy to QuerySeter
2015-02-14 20:33:06 +08:00
Hubery
8bd902814f Transaction
err处理写反了
2015-01-13 11:09:43 +08:00
Peter Fern
3731088b4a Add GroupBy to QuerySeter
Adds support for GroupBy to QuerySeter SELECT operations.
2015-01-10 15:26:41 +11:00
supar
1a1b0c14b9 Add attribute default to the column on create or alter commands. Skip columns which are keys and date or time data type 2014-11-06 17:43:53 +03:00
astaxie
90caeb4cf7 Revert "Add column default attribute" 2014-10-26 10:41:22 +08:00
astaxie
6c9249034d Merge pull request #887 from supar/add-column-default-attribute
Add column default attribute
2014-10-26 10:28:56 +08:00
supar
6f5162461e Add column DEFAULT attribute. Do not add if field is key or in
relations.
2014-10-24 14:51:35 +04:00
supar
c34c514bba Skip add DEFAULT if the field is in relations (rel or reverse) 2014-10-24 14:37:46 +04:00
astaxie
8ac2b9bf66 Merge branch 'master' into develop 2014-10-24 15:10:11 +08:00
astaxie
767083bd56 Revert "Add column default attribute" 2014-10-24 14:58:17 +08:00
astaxie
1a79513293 Merge branch 'master' into develop 2014-10-24 14:50:53 +08:00
supar
ab28edaf25 Fix comma in the switch, fix wronf function name 2014-10-17 13:02:18 +04:00
supar
04431a7a15 Fix function name fmt.Stprintf -> fmt.Sprintf 2014-10-17 12:59:24 +04:00
supar
b00c42b3df Fix undefind variable fieldType 2014-10-17 12:56:44 +04:00
supar
4cae7af3f9 Add attribute DEFAULT '' to the CREAT, ALTER constructors 2014-10-17 12:53:59 +04:00
supar
e4988b714e Add property colDefault to fieldInfo object, set its true if there is
orm configuration default `orm:"default(1)"`
2014-10-17 12:27:53 +04:00
ZhengYang
1f9281c830 minor code refactor 2014-09-11 15:17:48 +08:00
ZhengYang
ccab9a7044 add more sql keywords 2014-09-11 13:48:39 +08:00
astaxie
9013f5c6c7 Merge pull request #808 from ZhengYang/develop
more complete support for sql language
2014-09-09 14:21:49 +08:00
Zheng Yang
29b7ff84e1 more complete support for sql language 2014-09-09 14:17:12 +08:00
astaxie
fb0cc55822 update the orm read me 2014-09-09 11:55:28 +08:00
Zheng Yang
38eb29fa7b err msg spell correction 2014-09-08 18:41:42 +08:00
Zheng Yang
cca0a3f76d name correction: QueryBuilder instead of QueryWriter 2014-09-08 18:31:32 +08:00
Zheng Yang
f9a9b5a905 new query builder based on driver 2014-09-08 17:56:55 +08:00
Zheng Yang
c667895ce5 added new querybuilder 2014-09-08 17:47:15 +08:00
Zheng Yang
b2cdabb8a0 added query builder for orm 2014-09-08 17:37:01 +08:00
Peter Fern
d7c3727f96 Add support for basic type pointer fields
Allows models like:

```
type User struct {
	Id    int64
	Name  string
	Email *string `orm:"null"`
}
```

This helps a lot when doing JSON marshalling/unmarshalling.

Pointer fields should always be declared with the NULL orm tag for sanity, this
probably requires documentation.
2014-08-22 14:25:32 +10:00
astaxie
a144769515 update the documents & comments 2014-08-18 16:41:43 +08:00
astaxie
99c03a2b9c fix the nil judge 2014-08-08 13:16:51 +08:00
astaxie
b1b4dbb0e4 fix the nil judge 2014-08-08 12:02:44 +08:00
astaxie
77e1f26dd4 Merge pull request #728 from nizsheanez/null_pointer_panic_improve
[orm] improve null pointer panic message
2014-08-08 09:01:51 +08:00
Alexey Sharov
df8c73b23a improve null pointer panic message 2014-08-07 12:14:10 +07:00
astaxie
7ddd20340b orm: delete the old docs 2014-07-26 23:25:59 +08:00
astaxie
e635e274d4 Merge branch 'master' into develop 2014-07-09 08:43:37 +08:00
sandysong
707c951302 修正Detect Engine错误 2014-07-04 16:57:37 +08:00
astaxie
fefd8ddb5b beego: update licence& fix #669 2014-07-03 23:40:21 +08:00
astaxie
17a9c3c3a9 ORM:revert default value 2014-07-01 09:30:08 +08:00
astaxie
8946f816f9 orm:change the models_test default value 2014-07-01 00:30:05 +08:00
astaxie
34936dde35 Merge branch 'master' into develop 2014-06-30 23:50:45 +08:00
astaxie
0f170a80da update the comments fix #658 2014-06-25 10:39:37 +08:00
Bin Wang
7b7a95677a Generate default value while run ORM cmd tool 2014-06-22 10:52:14 +08:00
JessonChan
06f4bf493d ignore nil time 2014-06-10 22:10:58 +08:00
slene
2ed9b2bffd orm: add test for unexported struct field 2014-05-17 02:26:51 +08:00
jessonchan
6082a0af3e bug fixed 2014-05-17 02:26:51 +08:00
jessonchan
be30fb7937 refator func 2014-05-17 02:26:51 +08:00
astaxie
c188cbbcb4 update all files License 2014-05-17 02:26:50 +08:00
astaxie
4245521660 fix #576 2014-05-17 02:26:50 +08:00
Kyle McCullough
52817fb668 allow unexported fields on model structs 2014-05-17 02:26:49 +08:00
slene
65631e0522 fix orm test 2014-03-19 10:00:26 +08:00
slene
a879e412a1 #514 2014-03-19 09:46:09 +08:00
slene
95e67ba2c2 orm now support custom builtin types as model struct field or query args fix #489 2014-03-13 23:31:47 +08:00
slene
53aaf3b4a9 orm add ResetModelCache api for test case 2014-03-12 15:56:05 +08:00
slene
d5b5c18cf9 orm add GetDB api #433 2014-03-12 15:56:05 +08:00
slene
cacdb3228d orm add operator between #518 2014-03-12 15:56:05 +08:00
Daniel Hobe
9f3af59250 add support for sql.Null* types
Change instructions for sqlite3 tests to use in memory db for much faster
2014-03-12 15:56:05 +08:00
slene
430a0a971f orm insert skip auto_now_add when user custom a value 2014-03-12 15:56:04 +08:00
slene
9384e87083 orm 1. add api: NewOrmWithDB, AddAliasWthDB; 2. RawSeter -> add api: RowsToMap, RowsToStruct; 3. RawSeter -> change api: Values, ValuesList, ValuesFlat add optional params comumns. 2014-01-27 01:48:00 +08:00
Kyle McCullough
190039b6f8 Add a ReadOrCreate method:
m := &User{Name: "Kyle"}
// Returns a boolean indicating whether the object was created,
// the primary key of the object, or an error.
created, id, err := orm.ReadOrCreate(m, "Name")
2014-01-22 09:15:21 -06:00
FuXiaoHei
828a306069 add comments for orm package, done 2014-01-17 23:28:54 +08:00
傅小黑
4c527dde65 add comments for orm packages, part 2 2014-01-17 17:25:17 +08:00
傅小黑
f5a5ebe16b add comments for orm packages, part 1 2014-01-17 17:04:15 +08:00
slene
8d79f8387b #441 fix detect timezone in mysql 2014-01-10 16:50:03 +08:00
slene
b766f65c26 #436 support insert multi 2014-01-06 11:31:35 +08:00
slene
95c65de97c fix #440 2014-01-04 22:30:17 +08:00
slene
ef79a2b484 fix #440 2014-01-04 00:04:15 +08:00
slene
61c0b3e286 fix db locked 2013-12-31 09:55:29 +08:00
slene
412a4a04de #384 2013-12-30 23:04:13 +08:00
dongxu
2add87b829 name → Name
typo
2013-12-22 17:57:45 +08:00
slene
fc339fc3e0 orm detect mysql timezone #403 2013-12-21 21:00:29 +08:00
slene
1c52f6834a fix bug in postgres 2013-12-17 16:46:14 +08:00
slene
690d77e985 orm test add extra custom JsonField 2013-11-26 21:34:40 +08:00
slene
bcc8f60677 orm add test about CustomField 2013-11-26 18:32:12 +08:00
slene
e5904443d9 fix #302 2013-11-24 19:29:48 +08:00
bronze1man
ceb4aa9e25 [orm] QueryTable with nil ptr struct 2013-11-24 14:26:32 +08:00
slene
16352579f3 #294 2013-11-18 13:21:19 +08:00
slene
167ad203cb orm #276 2013-11-08 22:19:01 +08:00
slene
b644665952 orm set relation column name #259 2013-11-06 22:05:10 +08:00
slene
9492e4131b support reverse m2m relation 2013-11-06 21:08:12 +08:00
slene
89c03870c8 orm fix sqlite3 time convert 2013-11-02 00:51:53 +08:00
slene
1d44018128 orm fix for support custom field 2013-11-02 00:50:08 +08:00
slene
a4df6e403c fix #265 2013-11-01 18:32:03 +08:00
slene
6ea8dd5999 fix #255 2013-10-18 17:37:34 +08:00
slene
d043ebcdd3 orm support complete m2m operation api / auto load related api 2013-10-14 22:31:35 +08:00
slene
5d55ca19be orm add Exist func 2013-10-12 06:57:14 +08:00
slene
bf3830b6f0 orm add atomic set value 2013-10-09 20:28:54 +08:00
slene
658a671b79 all panic use Error 2013-10-09 11:37:16 +08:00
slene
001e33f310 fix #213 2013-09-22 19:20:40 +08:00
slene
09aca2528a orm RegisterDataBase remove default maxIdle/maxConn 2013-09-22 17:51:37 +08:00
slene
a616087cde orm now can specify engine for mysql. add api SetMaxIdleConns/SetMaxOpenConns(go 1.2) 2013-09-16 09:50:32 +08:00
slene
1596aa7a34 orm support use any numeric type set QuerySeter.Limit value 2013-09-13 18:06:44 +08:00
slene
3745bb7279 orm.Read support specify condition fields, orm.Update and QuerySeter All/One support omit fields. 2013-09-12 19:04:39 +08:00
slene
41dd6e580d orm 1. complete QueryRow/QueryRows api 2. QuerySeter.All support *[]Type and *[]*Type 2013-09-09 22:33:41 +08:00
slene
22d2de9fc7 orm fix 1. support Limit when use QuerySeter.One 2. return Local time 2013-09-06 19:03:47 +08:00
slene
6064a7ab2a orm RawSeter readValues set nil when get NULL 2013-08-30 12:38:32 +08:00
slene
8f5ca303b5 orm fix when use uint as pk 2013-08-30 12:32:05 +08:00
slene
49bbca0ce3 orm Improve syncdb 2013-08-27 12:33:27 +08:00
slene
6686d9235c orm fix create index 2013-08-25 13:50:50 +08:00
slene
7c72b2dca7 orm fix syncdb 2013-08-25 11:35:12 +08:00
slene
4c061feddf orm support custom multi unique / index 2013-08-22 21:19:58 +08:00
slene
02d2990576 orm all docs wiil update to beego.me 2013-08-22 18:35:35 +08:00
slene
94f7ba8bdf orm add uint uint32 uint64 auto increment support 2013-08-22 18:35:26 +08:00
slene
b114f258d6 orm update docs 2013-08-19 22:37:53 +08:00
slene
c38abf35da orm support auto create db 2013-08-19 22:37:39 +08:00
slene
aecf4af7f2 orm update docs 2013-08-17 07:41:22 +08:00
slene
618cbf1e66 orm string type default will use varchar(255) 2013-08-16 22:24:10 +08:00
slene
c81bbf9801 orm now use a filed named Id as default auto primary key, you can ignore orm:"auto" setting 2013-08-16 21:57:39 +08:00