database

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryMarshaller added in v0.5.0

type BinaryMarshaller[T Identifiable] struct{}

func (BinaryMarshaller[T]) Marshal added in v0.5.0

func (d BinaryMarshaller[T]) Marshal(v T) (string, []byte, error)

func (BinaryMarshaller[T]) Unmarshal added in v0.5.0

func (d BinaryMarshaller[T]) Unmarshal(v []byte) (T, error)

type Database added in v0.1.3

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

func Open

func Open(ctx context.Context, path string, ops Option) (*Database, error)

func (*Database) Close added in v0.1.3

func (s *Database) Close() error

type Identifiable added in v0.5.0

type Identifiable interface {
	ID() string
}

type Key added in v0.5.0

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

type Marshaler added in v0.1.3

type Marshaler[S any] interface {
	Marshal(S) (string, []byte, error)
	Unmarshal([]byte) (S, error)
}

type Option added in v0.5.0

type Option struct {
	InMemory bool
}

type Table

type Table[S any] struct {
	Name   string
	Tenant string
	// contains filtered or unexported fields
}

func NewTable added in v0.5.0

func NewTable[S any](db *Database, name string, tenant string, marshaler Marshaler[S]) *Table[S]

func (*Table[S]) Add

func (s *Table[S]) Add(data S) error

func (*Table[S]) All added in v0.1.3

func (s *Table[S]) All() ([]S, error)

func (*Table[S]) Delete added in v0.5.0

func (s *Table[S]) Delete(id string) error

func (*Table[S]) Get

func (s *Table[S]) Get(id string) (*S, error)

func (*Table[S]) Update added in v0.1.3

func (s *Table[S]) Update(data S) error

Jump to

Keyboard shortcuts

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