Commit Graph

41 Commits

Author SHA1 Message Date
Cr 878ac51e98
fix:throw model value required error (#6031)
* fix:throw model value required error

* chore:ingore typecheck

* chore:ingore errcheck

* refactor: use other error

* chore: gofumpt style
2023-02-08 13:40:41 +08:00
Ning 8c3673286d
preoload not allowd before count (#5023)
Co-authored-by: ningfei <accelerator314@outlook.com>
2022-01-30 18:17:06 +08:00
Atreya cf93b16730
Fix ErrInvalidTransaction error message (#4380) 2021-05-17 15:53:48 +08:00
Jinzhu d327926425 Check ReflectValue.CanAddr before set field value 2021-04-19 21:37:38 +08:00
Chris Faulkner 15a46bc042
Fix some typos (#4294) 2021-04-19 21:03:39 +08:00
Jinzhu f3bdfa8261 Add IgnoreRecordNotFoundError option for logger 2021-04-09 10:21:01 +08:00
heige 495ec4bd87
invalid db error and value and invalid value length error (#4151) 2021-03-07 10:56:32 +08:00
Jinzhu 072f1de83a Add DryRunModeUnsupported Error for Row/Rows 2020-09-18 21:35:46 +08:00
Jinzhu 48b395b760 returns ErrEmptySlice when creating with zero length slice 2020-09-03 11:32:30 +08:00
Jinzhu 50826742fd Add error gorm.ErrInvalidData 2020-08-18 18:00:36 +08:00
Qt f4cfa9411b
define err with the same code style (#3199) 2020-07-26 10:03:58 +08:00
Jinzhu 69d8111893 Fix panic when using invalid data, close #3193 2020-07-24 08:32:50 +08:00
Jinzhu f5566288de Add SetColumn, Changed method 2020-06-30 16:53:54 +08:00
Jinzhu f4bfc435cc Add register plugin API 2020-06-23 09:38:51 +08:00
Jinzhu 7dc255acfe Add SavePoint/RollbackTo/NestedTransaction 2020-06-19 18:30:04 +08:00
Jinzhu eda2f023b0 Add Distinct support 2020-06-05 19:19:12 +08:00
Jinzhu befef0c9a9 Improve Hooks 2020-06-01 00:12:20 +08:00
Jinzhu dea48a8c59 Test Many2Many Association 2020-05-26 00:16:44 +08:00
Jinzhu 2db33730b6 Add Slice Association for BelongsTo 2020-05-24 20:53:20 +08:00
Jinzhu 41697d58d3 Handle preload 2020-05-07 10:03:48 +08:00
Jinzhu a145d7e019 Refactor structure 2020-03-09 14:25:50 +08:00
Jinzhu e509b3100d Implement callbacks 2020-01-31 06:35:25 +08:00
Jinzhu 9d5b9834d9 Refactor builder 2020-01-30 19:47:00 +08:00
Jinzhu f0d514e330 Cleanup 2020-01-28 16:22:07 +08:00
Zed 447d578628 amended comments in error.go for clarity and grammar; for more polish when using IDEs (e.g. VSCODE) that show comments as help text (#2182) 2019-01-02 21:23:43 +08:00
Eason Lin 32455088f2 doc: document ErrRecordNotFound error more clear (#2015)
* doc: document ErrRecordNotFound error more clear

* fix goimports

* fix goimports

* undo change
2018-08-19 07:14:33 +08:00
Jinzhu c54d23473c Add IsRecordNotFoundError method 2018-02-12 09:38:16 +08:00
Teppei Fukuda 6e456250f7 Erros skip nil in Add function (#1566) 2017-09-04 22:25:57 +08:00
Caleb Thompson c063624c91
Make gorm.Errors available for use outside gorm
gorm.Errors, which usefully implements `error` for an `[]error` as
returned by `DB.GetError()` was already exported, but because it used a
private field `errors`, it was not able to be created due to the
compile-time error:

    implicit assignment of unexported field 'errors' in gorm.Errors literal

The trivial solution would be to export the `errors` field on
`gorm.Errors`, but this led to the issue that the common pattern of
checking `err != nil` failed because a struct{error: nil} != nil.

We can take advantage of type aliasing here to make Errors an []error,
which can in fact be nil and would pass `err != nil` on the happy path.

* Remove `(Errors) GetErrors()`, as it's less useful when Errors is an
  []error which can be iterated over. While this is technically a
  breaking change, we never expose an Errors and its difficult to build
  one (it can be done with the existing `(Errors) Add(error)`), but
  awkwardly. This removal can be reverted without issue and we can make
  it an identity method, but it seemed an opportune time to reduce API
  surface area on something that likely isn't used.
* Remove errorsInterface, as it's not useful without `(Errors)
  GetErrors()`
* Change `(*Errors) Add(error)` => `(Errors) Add(error...) Errors`
  because we can't modify even a *Errors when it's a type alias. This is
  more idiomatic as it follows the pattern of `slice = append(slice,
  element)` Go developers are familiar with.
2016-10-25 11:22:50 -05:00
Jinzhu 9fd05d1bad Print warning message when using unaddressable value with Update 2016-04-04 21:33:11 +08:00
Jinzhu 88184a989e Update godoc 2016-03-07 21:09:05 +08:00
Jinzhu ec110657da Refactor based on golint 2016-03-07 17:49:55 +08:00
Jinzhu d9229c5a7b Extract method Scan from rows 2016-01-13 16:53:11 +08:00
Jinzhu 81c00fdc8f Don't add duplicated error 2015-08-18 11:09:03 +08:00
Jinzhu dd0d4d931f Add errorsInterface 2015-08-14 14:53:26 +08:00
Jinzhu 0996ddb604 Rename Errors to GetErrors 2015-08-14 12:29:53 +08:00
Jinzhu 309740983e Add Errors 2015-08-14 11:04:05 +08:00
Jinzhu 73b6f0eace Linting according to golint 2015-02-17 08:34:01 +08:00
Jinzhu 0ad707b410 Yay, all tests passed 2013-11-16 18:42:47 +08:00
Jinzhu 3cfa19b761 Move all chain method to main.go 2013-11-16 11:36:30 +08:00
Jinzhu 52fd87c57b Define some error codes 2013-11-15 18:36:39 +08:00