core

package
v0.0.0-...-a4f6240 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryKeyValueStore

type InMemoryKeyValueStore[Type interface{}] struct {
	// contains filtered or unexported fields
}

func NewInMemoryKeyValueStore

func NewInMemoryKeyValueStore[Type interface{}]() *InMemoryKeyValueStore[Type]

func (*InMemoryKeyValueStore[Type]) Delete

func (store *InMemoryKeyValueStore[Type]) Delete(key string) error

func (*InMemoryKeyValueStore[Type]) Get

func (store *InMemoryKeyValueStore[Type]) Get(key string) (Type, error)

func (*InMemoryKeyValueStore[Type]) Set

func (store *InMemoryKeyValueStore[Type]) Set(key string, value Type) error

func (*InMemoryKeyValueStore[Type]) WithContext

func (store *InMemoryKeyValueStore[Type]) WithContext(ctx context.Context) KeyValueStore[string, Type]

type KeyValueStore

type KeyValueStore[Key comparable, Type interface{}] interface {
	// Get returns the value associated with the given key.
	Get(key Key) (Type, error)
	// Set associates the given value with the given value.
	Set(key Key, value Type) error
	// Delete removes the value associated with the given key.
	Delete(key Key) error

	WithContext(ctx context.Context) KeyValueStore[Key, Type]
}

A Cache stores values of a given type under a given key.

type List

type List[Type interface{}] interface {
	Index(Type) (int64, error)
	Len() int64
	Append(Type) (int64, error)
	Remove(int64) error
	WithContext(ctx context.Context) List[Type]
	Slice() []Type
}

type Repository

type Repository[IdType comparable, Type interface{}] interface {
	FindAll(ctx context.Context) ([]Type, error)
	FindById(ctx context.Context, id IdType) (Type, error)
	Save(ctx context.Context, entity Type) error
	Update(ctx context.Context, entity Type) error
	DeleteById(ctx context.Context, id IdType) error
}

A repository persists entities of a given type. Entities must be unique by their id.

type SecretValue

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

func NewSecretValue

func NewSecretValue(value string) *SecretValue

func (*SecretValue) MarshalJSON

func (s *SecretValue) MarshalJSON() ([]byte, error)

func (*SecretValue) String

func (s *SecretValue) String() string

Jump to

Keyboard shortcuts

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