crud

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

Create performs the basic create operation.

func Delete

Delete performs the basic delete operation.

func Info

Info performs the basic info operation.

func Retrieve

Retrieve performs the basic retrieve operation.

func RetrieveMany

func RetrieveMany(bctx bahamut.Context, m manipulate.Manipulator, objs elemental.Identifiables, opts ...Option) error

RetrieveMany performs the basic retrieve many operation.

func Update

Update performs the basic update operation.

Types

type ErrPreWriteHook

type ErrPreWriteHook struct {
	Err error
}

A ErrPreWriteHook is the kind of error returned when execution of a pre write hook fails.

func (ErrPreWriteHook) Error

func (e ErrPreWriteHook) Error() string

func (ErrPreWriteHook) Unwrap

func (e ErrPreWriteHook) Unwrap() error

Unwrap returns the warped error.

type Option

type Option func(*cfg)

An Option defines optional behaviors for the crud functions.

func OptionPostWriteHook

func OptionPostWriteHook(hook PostWriteHook) Option

OptionPostWriteHook defines the function to call just after the final write operation runs. It will be given the object that was written.

func OptionPreWriteHook

func OptionPreWriteHook(hook PreWriteHook) Option

OptionPreWriteHook defines the function to call just before the final write operation runs. It will be given the object that is about to be written and eventually the original object that got pulled from the database. If this function returns an error, the operation stops and the error will be returned wrapped into a PreWriteHookError.

type PostWriteHook

type PostWriteHook func(obj elemental.Identifiable)

PostWriteHook is the type of function yiou can pass as a post write hook.

type PreWriteHook

type PreWriteHook func(obj elemental.Identifiable, orig elemental.Identifiable) error

PreWriteHook is the type of function you can pass as a pre write hook.

type Timeable added in v0.11.0

type Timeable interface {
	SetCreateTime(time.Time)
	GetCreateTime() time.Time
	SetUpdateTime(time.Time)
	GetUpdateTime() time.Time
}

A Timeable is an object that can keep track of its creation and last update time.

Jump to

Keyboard shortcuts

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