crud

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRUD

type CRUD[Model any] struct {
	List     ListQueryFunc
	Retrieve RetrieveQueryFunc
	Create   CreateQueryFunc
	Update   UpdateQueryFunc
	Destroy  DestroyQueryFunc
}

CRUD is a collection of queries that are executed by the views

func (*CRUD[Model]) WithCreate

func (q *CRUD[Model]) WithCreate(f CreateQueryFunc) *CRUD[Model]

func (*CRUD[Model]) WithDestroy

func (q *CRUD[Model]) WithDestroy(f DestroyQueryFunc) *CRUD[Model]

func (*CRUD[Model]) WithList

func (q *CRUD[Model]) WithList(f ListQueryFunc) *CRUD[Model]

func (*CRUD[Model]) WithRetrieve

func (q *CRUD[Model]) WithRetrieve(f RetrieveQueryFunc) *CRUD[Model]

func (*CRUD[Model]) WithUpdate

func (q *CRUD[Model]) WithUpdate(f UpdateQueryFunc) *CRUD[Model]

type CreateQueryFunc

type CreateQueryFunc func(ctx *gin.Context, new models.InternalValue) (models.InternalValue, error)

CreateQueryFunc is a function that executes a create query.

type DestroyQueryFunc

type DestroyQueryFunc func(ctx *gin.Context, id any) error

DestroyQueryFunc is a function that executes a delete query.

type ListQueryFunc

type ListQueryFunc func(ctx *gin.Context) ([]models.InternalValue, error)

ListQueryFunc is a function that executes a list query.

type RetrieveQueryFunc

type RetrieveQueryFunc func(ctx *gin.Context, id any) (models.InternalValue, error)

RetrieveQueryFunc is a function that executes a retrieve query.

type UpdateQueryFunc

type UpdateQueryFunc func(ctx *gin.Context, old models.InternalValue, new models.InternalValue, id any) (
	models.InternalValue, error,
)

UpdateQueryFunc is a function that executes an update query.

Jump to

Keyboard shortcuts

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