data

package
v0.0.0-...-a83c1e6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func New

func New[T any](db *gorm.DB) Store[T]

New creates a new Store struct

func (*Store[T]) Create

func (s *Store[T]) Create(request T, ctx context.Context) (T, error)

Create creates a new entry in the database

func (*Store[T]) Delete

func (s *Store[T]) Delete(id int, ctx context.Context) error

Delete deletes an entry from the database

func (*Store[T]) Exists

func (s *Store[T]) Exists(id int) bool

Exists checks if an entry exists in the database

func (*Store[T]) ExistsByName

func (s *Store[T]) ExistsByName(name string) bool

ExistsByName checks if an entry exists in the database

func (*Store[T]) List

func (s *Store[T]) List() ([]T, error)

List retrieves all entries from the database

func (*Store[T]) Read

func (s *Store[T]) Read(id int) (T, error)

Read retrieves an entry from the database

func (*Store[T]) Update

func (s *Store[T]) Update(id int, request T, ctx context.Context) (T, error)

Update updates an entry in the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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