model

package
v0.0.0-...-3910e7f Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter = db.FileFilter

type Item

type Item = db.File

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is a struct that contains the SQL statement builder and the PostgreSQL client.

func NewStorage

func NewStorage(client psql.Client) *Model

NewStorage is a constructor function that returns a new instance of the Model.

func (*Model) Create

func (m *Model) Create(ctx context.Context, item *Item) (*uuid.UUID, error)

func (*Model) Delete

func (m *Model) Delete(ctx context.Context, id *uuid.UUID) error

func (*Model) Get

func (m *Model) Get(ctx context.Context, filter *Filter) (*Item, error)

func (*Model) List

func (m *Model) List(ctx context.Context, filter *Filter) (*map[uuid.UUID]Item, error)

func (*Model) MaxSortOrder

func (m *Model) MaxSortOrder(ctx context.Context) (*uint64, error)

func (*Model) Patch

func (m *Model) Patch(ctx context.Context, id *uuid.UUID, fields *map[string]interface{}) error

func (*Model) TableIndexCount

func (m *Model) TableIndexCount(ctx context.Context) (*uint64, error)

func (*Model) Update

func (m *Model) Update(ctx context.Context, item *Item) error

func (*Model) UpdatedAt

func (m *Model) UpdatedAt(ctx context.Context, id *uuid.UUID) (*time.Time, error)

type Storage

type Storage interface {
	Get(context.Context, *Filter) (*Item, error)
	List(context.Context, *Filter) (*map[uuid.UUID]Item, error)
	Create(context.Context, *Item) (*uuid.UUID, error)
	Update(context.Context, *Item) error
	Patch(context.Context, *uuid.UUID, *map[string]interface{}) error
	UpdatedAt(context.Context, *uuid.UUID) (*time.Time, error)
	MaxSortOrder(context.Context) (*uint64, error)
	TableIndexCount(context.Context) (*uint64, error)
	Delete(context.Context, *uuid.UUID) error
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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