Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SoftDeleteScope = &builder.Scope{ Name: "soft-deletes", Query: func(b *builder.Builder) *builder.Builder { return b.Where(b.GetTable()+".deleted_at", "=", nil) }, Delete: func(next func(q *builder.Builder, tx database.DB) error) func(q *builder.Builder, tx database.DB) error { return func(q *builder.Builder, tx database.DB) error { return q.Update(tx, builder.Updates{ "deleted_at": time.Now(), }) } }, }
Functions ¶
This section is empty.
Types ¶
type SoftDelete ¶
func (*SoftDelete) Scopes ¶
func (f *SoftDelete) Scopes() []*builder.Scope
type Timestamps ¶
type Timestamps struct { CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
func (*Timestamps) BeforeSave ¶
BeforeSave implements hooks.BeforeSaver.
Click to show internal directories.
Click to hide internal directories.