storage

package
v0.0.0-...-e5f8ed5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB(cfg *config.DatabaseConfig) (*gorm.DB, error)

InitDB initialize database instance based on application configuration

Types

type GetInput

type GetInput struct {
	// ID of the entity
	ID int64
	// Name of the entity
	Name string
	// ProjectID of the entity belongs to
	ProjectID int64
}

GetInput is common type used for querying specific entity in its storage

func (GetInput) String

func (i GetInput) String() string

String return human-readable string of GetInput

type ListInput

type ListInput struct {
	// Project ID
	ProjectID int64
	// Starting offset of the list request
	Offset int
	// Limit number of entities returned
	Limit int
}

ListInput is common type used for querying list of entities in its storage

func ListInputFromOption

func ListInputFromOption(projectID int64, detail *timberv1.ListOption) ListInput

ListInputFromOption creates list input from list request options

type LogWriter

type LogWriter interface {
	// Get a log writer given its identifier
	Get(ctx context.Context, input GetInput) (*model.LogWriter, error)
	// Create a new log writer and return the stored log writer with ID populated or error
	Create(ctx context.Context, lw *model.LogWriter) (*model.LogWriter, error)
	// Update an existing log writer and return the stored log writer or error
	Update(ctx context.Context, lw *model.LogWriter) (*model.LogWriter, error)
	// List all log writer given the list input
	List(ctx context.Context, listInput ListInput) ([]*model.LogWriter, error)
}

LogWriter interface providing access for LogWriter storage

func NewLogWriter

func NewLogWriter(db *gorm.DB) LogWriter

NewLogWriter creates new Log Writer storage

type ObservationService

type ObservationService interface {
	// Get an observation service given its identifier
	Get(ctx context.Context, input GetInput) (*model.ObservationService, error)
	// Create a new observation service and return the stored observation service with ID populated or error
	Create(ctx context.Context, lw *model.ObservationService) (*model.ObservationService, error)
	// Update an existing observation service and return the stored observation service or error
	Update(ctx context.Context, lw *model.ObservationService) (*model.ObservationService, error)
	// List all observation service given the list input
	List(ctx context.Context, listInput ListInput) ([]*model.ObservationService, error)
}

ObservationService interface providing access for ObservationService storage

func NewObservationService

func NewObservationService(db *gorm.DB) ObservationService

NewObservationService creates new observation service storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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