repository

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMessage

type CreateMessage any

CreateMessage is an external request to create an entity for consumers. TODO: ideally all update messages should clearly expose the identifier in order to get the entity with it! UpdateMessage interface{ ID() string }

type Entity

type Entity any

Entity is the internal representation of an api resource, which is stored in the backend.

type IP

type Message

type Message any

Message is the external representation of an api resource for consumers.

type ProjectScope

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

type Query

type Query any

Query is an external representation to filter an entity for consumers.

type Repo added in v0.0.4

type Repo any

Repo is the typed repository in order to expose public functions on the repository to the consumers.

type Repository

type Repository[R Repo, E Entity, M Message, C CreateMessage, U UpdateMessage, Q Query] interface {
	Get(ctx context.Context, id string) (E, error)

	Create(ctx context.Context, c C) (E, error)

	Update(ctx context.Context, id string, u U) (E, error)

	Delete(ctx context.Context, id string) (E, error)

	Find(ctx context.Context, query Q) (E, error)
	List(ctx context.Context, query Q) ([]E, error)

	ConvertToInternal(msg M) (E, error)
	ConvertToProto(e E) (M, error)

	AdditionalMethods() R
}

type Store

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

func New

func (*Store) FilesystemLayout

func (s *Store) FilesystemLayout() FilesystemLayout

func (*Store) IP

func (s *Store) IP(project string) IP

func (*Store) Image

func (s *Store) Image() Image

func (*Store) IpDeleteHandleFn

func (r *Store) IpDeleteHandleFn(ctx context.Context, t *asynq.Task) error

func (*Store) Network

func (s *Store) Network(project string) Network

func (*Store) NetworkDeleteHandleFn added in v0.0.3

func (r *Store) NetworkDeleteHandleFn(ctx context.Context, t *asynq.Task) error

NetworkDeleteHandleFn is called async to ensure all dependent entities are deleted Async deletion must be scheduled by async.NewNetworkDeleteTask

func (*Store) Partition

func (s *Store) Partition() Partition

func (*Store) Project

func (s *Store) Project(project string) Project

func (*Store) Tenant

func (s *Store) Tenant() Tenant

func (*Store) UnscopedIP

func (s *Store) UnscopedIP() IP

func (*Store) UnscopedNetwork

func (s *Store) UnscopedNetwork() Network

func (*Store) UnscopedProject

func (s *Store) UnscopedProject() Project

type UpdateMessage

type UpdateMessage any

UpdateMessage is an external request to update an entity for consumers.

Jump to

Keyboard shortcuts

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