Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DateFields ¶
type DateFields struct { CreatedAt time.Time `json:"created_at" bson:"created_at"` UpdatedAt time.Time `json:"updated_at" bson:"updated_at"` }
DateFields struct contain `created_at` and `updated_at` fields that autofill on insert/update model.
func (*DateFields) Creating ¶
func (f *DateFields) Creating() error
Creating hook used here to set `created_at` field value on inserting new model into database.
func (*DateFields) Saving ¶
func (f *DateFields) Saving() error
Saving hook used here to set `updated_at` field value on create/update model.
type Entity ¶
type Entity struct { IDField `bson:",inline"` DateFields `bson:",inline"` }
Entity struct contain model's default fields.
type IDField ¶
IDField struct contain model's ID field.
type Repository ¶
type Repository struct { }
func (Repository) ReplaceErr ¶
func (a Repository) ReplaceErr(err error, notfoundErr error) error
Click to show internal directories.
Click to hide internal directories.