uniq

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adder

type Adder[V any] interface {
	Add(ctx context.Context, value V) error
}

type Deleter

type Deleter[V any] interface {
	Delete(ctx context.Context, h Hash) error
}

type EnsureOption added in v0.0.6

type EnsureOption[V any] struct {
	OnInsert   func(st sqluct.StorageOf[V], o *sqluct.Options)
	OnUpdate   func(st sqluct.StorageOf[V], o *sqluct.Options)
	SkipUpdate bool
}

type Ensurer

type Ensurer[V any] interface {
	Ensure(ctx context.Context, value V, options ...EnsureOption[V]) (V, error)
}

type File

type File struct {
	Head
	Size int64  `db:"size" title:"File Size" json:"size" readOnly:"true"`
	Path string `db:"path" title:"File Path" json:"path" readOnly:"true"`
}

func (*File) SetPath

func (v *File) SetPath(ctx context.Context, path string) (err error)

type Finder

type Finder[V any] interface {
	FindByHash(ctx context.Context, hash Hash) (V, error)
	FindByHashes(ctx context.Context, hashes ...Hash) ([]V, error)
	Exists(ctx context.Context, hash Hash) (bool, error)
	FindAll(ctx context.Context) ([]V, error)
}

type Hash

type Hash int64

func StringHash

func StringHash(s string) Hash

func (Hash) MarshalJSON

func (h Hash) MarshalJSON() ([]byte, error)

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

func (Hash) PrepareJSONSchema

func (h Hash) PrepareJSONSchema(schema *jsonschema.Schema) error

func (Hash) String

func (h Hash) String() string

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(data []byte) error

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(data []byte) error
type Head struct {
	Time
	Hash Hash `db:"hash" formType:"hidden" json:"hash" description:"Unique hash value." title:"ImageHash Id"`
}

func (*Head) CreatedAtPtr

func (h *Head) CreatedAtPtr() *time.Time

func (*Head) GetCreatedAt

func (h *Head) GetCreatedAt() time.Time

func (*Head) HashPtr

func (h *Head) HashPtr() *Hash

func (*Head) SetCreatedAt

func (h *Head) SetCreatedAt(t time.Time)

type Time

type Time struct {
	CreatedAt time.Time `db:"created_at,omitempty" formType:"hidden" json:"created_at" title:"Created At" description:"Timestamp of creation."`
}

type Updater

type Updater[V any] interface {
	Update(ctx context.Context, value V) error
}

Jump to

Keyboard shortcuts

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