crud

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRecordAlreadyExists = errors.New("record already exists")

Functions

This section is empty.

Types

type Service

type Service[T any] struct {
	// contains filtered or unexported fields
}

func NewService

func NewService[T any](db *bun.DB) *Service[T]

func (*Service[T]) Delete

func (s *Service[T]) Delete(ctx context.Context, query string, args ...any) error

func (*Service[T]) Find

func (s *Service[T]) Find(ctx context.Context, query string, args ...any) ([]T, int, error)

func (*Service[T]) FindOne

func (s *Service[T]) FindOne(ctx context.Context, query string, args ...any) (*T, error)

func (*Service[T]) Insert

func (s *Service[T]) Insert(ctx context.Context, model *T) error

func (*Service[T]) Update

func (s *Service[T]) Update(ctx context.Context, model *T, columns []string, query string, args ...any) error

func (*Service[T]) UpdatePk

func (s *Service[T]) UpdatePk(ctx context.Context, model *T, columns []string) error

Jump to

Keyboard shortcuts

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