repository

package
v0.0.0-...-f96b470 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package repository declares the repository interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey interface {
	Validate(ctx context.Context, s string) (uuid.UUID, error)
}

APIKey is the API key repository.

type Options

type Options struct {
	DSN    string
	Type   Type
	Logger *slog.Logger
	APIKey string
}

Options represents the options for the handlers.

type Opts

type Opts func(*Options)

Opts represents a function that modifies the options.

func WithAPIKey

func WithAPIKey(apiKey string) Opts

WithAPIKey sets the API key.

func WithDSN

func WithDSN(dsn string) Opts

WithDSN sets the DSN.

func WithType

func WithType(repositoryType string) Opts

WithType sets the repository type.

type Project

type Project interface {
	GetByID(ctx context.Context, id uuid.UUID) (*domain.Project, error)
	GetByName(ctx context.Context, name string) (*domain.Project, error)
	List(ctx context.Context, getProjectsRequest *domain.ListProjectsRequest) ([]*domain.Project, error)
	Create(ctx context.Context, project *domain.CreateProjectRequest) (*domain.Project, error)
}

Project is the project repository.

type Run

type Run interface {
	Get(ctx context.Context, id uuid.UUID) (*domain.Run, error)
	Create(ctx context.Context, createRunRequest *domain.CreateRunRequest) (*domain.Run, error)
	Update(ctx context.Context, updateRunRequest *domain.UpdateRunRequest) (*domain.Run, error)
	ListForProject(ctx context.Context, listForProject *domain.ListRunsForProjectRequest) ([]*domain.Run, error)
}

Run is the run repository.

type Scenario

type Scenario interface {
	Create(ctx context.Context, scenario *domain.CreateScenarioRequest) (*domain.Scenario, error)
	GetForProject(ctx context.Context, getForProjectRequest *domain.GetScenariosForProjectRequest) ([]*domain.Scenario, error)
}

Scenario is the scenario repository.

type Type

type Type string

Type is the type of repository.

const (
	TypeSQLite Type = "sqlite"
)

Repository types.

func TypeFromString

func TypeFromString(repositoryType string) Type

TypeFromString converts a string to a repository type.

type Wrapper

type Wrapper struct {
	Project  Project
	Run      Run
	Scenario Scenario
	APIKey   APIKey
}

Wrapper wraps all repositories.

func NewSQLiteWrapper

func NewSQLiteWrapper(dsn string, options *Options) (*Wrapper, error)

NewSQLiteWrapper initialises sqlite repository implementation.

func NewWrapper

func NewWrapper(opts ...Opts) (*Wrapper, error)

NewWrapper initialises the repository wrapper.

Directories

Path Synopsis
Package domain declares the domain models for the repository.
Package domain declares the domain models for the repository.
Package sqlite implements the sqlite repository.
Package sqlite implements the sqlite repository.

Jump to

Keyboard shortcuts

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