repo

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create[M any](db *gorm.DB, input M) error

func Delete

func Delete[M any](db *gorm.DB, input M) error

func Filter

func Filter[M any](db *gorm.DB, q query.Builder) ([]*M, query.Builder, error)

func First

func First[M any](db *gorm.DB, where ...any) (*M, error)

func Update

func Update[M any](db *gorm.DB, input M) error

Types

type CRUD

type CRUD[Model, Request any] interface {
	Saver[Model]
	Identifier[Model]
	Filterer[Model]
	Creator[Model, Request]
	Updater[Model, Request]
	Deleter[Model]
}

type Creator

type Creator[Model any, Request any] interface {
	Create(cx context.Context, r Request) (Model, error)
}

type Deleter

type Deleter[Model any] interface {
	Delete(cx context.Context, m Model) error
}

type Filterer

type Filterer[Model any] interface {
	Filter(cx context.Context, q query.Builder) ([]Model, query.Builder, error)
}

type Identifier

type Identifier[Model any] interface {
	GetByID(cx context.Context, id goat.ID, loadRelations ...bool) (Model, error)
}

type Saver

type Saver[Model any] interface {
	Save(cx context.Context, m Model) error
}

type Updater

type Updater[Model any, Request any] interface {
	Update(cx context.Context, id goat.ID, r Request) (Model, error)
}

Jump to

Keyboard shortcuts

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