log

package
v0.21.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

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

)
View Source
const (
	// CreateBuildIDIndex represents a query to create an
	// index on the logs table for the build_id column.
	CreateBuildIDIndex = `
CREATE INDEX
IF NOT EXISTS
logs_build_id
ON logs (build_id);
`
)

Variables

This section is empty.

Functions

func New

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

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

Types

type EngineOpt

type EngineOpt func(*engine) error

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

func WithClient

func WithClient(client *gorm.DB) EngineOpt

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

func WithCompressionLevel

func WithCompressionLevel(level int) EngineOpt

WithCompressionLevel sets the compression level in the database engine for Logs.

func WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Logs.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

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

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

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

type LogInterface added in v0.20.0

type LogInterface interface {

	// CreateLogIndexes defines a function that creates the indexes for the logs table.
	CreateLogIndexes(context.Context) error
	// CreateLogTable defines a function that creates the logs table.
	CreateLogTable(context.Context, string) error

	// CountLogs defines a function that gets the count of all logs.
	CountLogs(context.Context) (int64, error)
	// CountLogsForBuild defines a function that gets the count of logs by build ID.
	CountLogsForBuild(context.Context, *library.Build) (int64, error)
	// CreateLog defines a function that creates a new log.
	CreateLog(context.Context, *library.Log) error
	// DeleteLog defines a function that deletes an existing log.
	DeleteLog(context.Context, *library.Log) error
	// GetLog defines a function that gets a log by ID.
	GetLog(context.Context, int64) (*library.Log, error)
	// GetLogForService defines a function that gets a log by service ID.
	GetLogForService(context.Context, *library.Service) (*library.Log, error)
	// GetLogForStep defines a function that gets a log by step ID.
	GetLogForStep(context.Context, *library.Step) (*library.Log, error)
	// ListLogs defines a function that gets a list of all logs.
	ListLogs(context.Context) ([]*library.Log, error)
	// ListLogsForBuild defines a function that gets a list of logs by build ID.
	ListLogsForBuild(context.Context, *library.Build, int, int) ([]*library.Log, int64, error)
	// UpdateLog defines a function that updates an existing log.
	UpdateLog(context.Context, *library.Log) error
}

LogInterface represents the Vela interface for log functions with the supported Database backends.

Jump to

Keyboard shortcuts

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