settings

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatePostgresTable represents a query to create the Postgres settings table.
	CreatePostgresTable = `` /* 418-byte string literal not displayed */

	// CreateSqliteTable represents a query to create the Sqlite settings table.
	CreateSqliteTable = `` /* 441-byte string literal not displayed */

)
View Source
const (
	TableSettings = "settings"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine added in v0.27.0

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

Engine represents the settings functionality that implements the SettingsInterface interface.

func New

func New(opts ...EngineOpt) (*Engine, error)

New creates and returns a Vela service for integrating with settings in the database.

func (*Engine) CreateSettings added in v0.27.0

func (e *Engine) CreateSettings(ctx context.Context, s *settings.Platform) (*settings.Platform, error)

CreateSettings creates a platform settings record in the database.

func (*Engine) CreateSettingsTable added in v0.27.0

func (e *Engine) CreateSettingsTable(ctx context.Context, driver string) error

CreateSettingsTable creates the settings table in the database.

func (*Engine) GetSettings added in v0.27.0

func (e *Engine) GetSettings(ctx context.Context) (*settings.Platform, error)

GetSettings gets platform settings from the database.

func (*Engine) UpdateSettings added in v0.27.0

func (e *Engine) UpdateSettings(ctx context.Context, s *settings.Platform) (*settings.Platform, error)

UpdateSettings updates a platform settings in the database.

type EngineOpt

type EngineOpt func(*Engine) error

EngineOpt represents a configuration option to initialize the database engine for Settings.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for Settings.

func WithContext

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Settings.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Settings.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

WithSkipCreation sets the skip creation logic in the database engine for Settings.

type SettingsInterface

type SettingsInterface interface {
	// CreateSettings defines a function that creates a platform settings record.
	CreateSettings(context.Context, *settings.Platform) (*settings.Platform, error)
	// GetSettings defines a function that gets platform settings.
	GetSettings(context.Context) (*settings.Platform, error)
	// UpdateSettings defines a function that updates platform settings.
	UpdateSettings(context.Context, *settings.Platform) (*settings.Platform, error)
}

Jump to

Keyboard shortcuts

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