database

package
v0.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBookModel

func NewBookModel(coll *mongo.Collection) *mgs.Model[Book, *mgs.DefaultSchema]

Types

type Book

type Book struct {
	Title     string             `json:"title"  bson:"title"`
	Author    primitive.ObjectID `json:"author" bson:"author"`
	Price     float64            `json:"price"  bson:"price"`
	Deleted   bool               `json:"-"      bson:"deleted"`
	DeletedAt *time.Time         `json:"-"      bson:"deletedAt"`
}

func (*Book) AfterCreate

func (book *Book) AfterCreate(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) AfterDelete

func (book *Book) AfterDelete(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) AfterFind

func (book *Book) AfterFind(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) AfterUpdate

func (book *Book) AfterUpdate(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) AfterValidate

func (book *Book) AfterValidate(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) BeforeCreate

func (book *Book) BeforeCreate(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) BeforeDelete

func (book *Book) BeforeDelete(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) BeforeFind

func (book *Book) BeforeFind(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) BeforeUpdate

func (book *Book) BeforeUpdate(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) BeforeValidate

func (book *Book) BeforeValidate(ctx context.Context, arg *mgs.HookArg[Book]) error

func (*Book) Validate

func (book *Book) Validate(ctx context.Context, arg *mgs.HookArg[Book]) error

type BookDoc

type BookDoc = mgs.Document[Book, *mgs.DefaultSchema]

type BookModel

type BookModel = mgs.Model[Book, *mgs.DefaultSchema]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL