db

package
v0.0.0-...-2ccd497 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SessionLogWriteCloser

func SessionLogWriteCloser(
	rootCtx context.Context,
	session Session,
	logWriteTimeout time.Duration,
) io.WriteCloser

SessionLogWriteCloser wraps the session as a io.WriteCloser instance. It's not allowed to call Write() concurrently.

Types

type CreateParsedTableOpts

type CreateParsedTableOpts struct {
	Session   *v1.Session
	TableName string
	SQL       string
}

type CreateSessionOpts

type CreateSessionOpts struct {
	// Prefix specifies the session name prefix.
	Prefix string

	// Name - optional name for the session. Fallback to session id if empty.
	Name string

	// ReuseExisting - if true, will try to reuse existing session with the same prefix.
	// If there are multiple existing sessions with the same prefix, the first one
	// in ascending alphabetical order will be used.
	ReuseExisting bool
}

type Provider

type Provider interface {
	CreateSession(ctx context.Context, opts *CreateSessionOpts) (string, Session, error)
	CreateParsedTable(ctx context.Context, opts *CreateParsedTableOpts) error

	GetQueryService() (QueryService, error)

	GetSessionRepository() (SessionRepository, error)
}

type QueryService

type QueryService interface {
	QueryTable(
		ctx context.Context,
		payload *v1.QueryTableRequest,
	) (*v1.QueryTableResponse, error)
}

type Session

type Session interface {
	WriteLogLinesBatch(ctx context.Context, payload WriteLogLinesBatchPayload) error
}

type SessionRepository

type SessionRepository interface {
	ListSessions(ctx context.Context) ([]*v1.Session, error)
	GetSessionByID(ctx context.Context, sessionID string) (*v1.Session, error)
	UpdateSession(ctx context.Context, session *v1.Session) error
}

type SqliteProvider

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

func NewSqliteProvider

func NewSqliteProvider(dbPath string) (*SqliteProvider, error)

NewSqliteProvider creates a sqlite based provider.

func (*SqliteProvider) CreateParsedTable

func (p *SqliteProvider) CreateParsedTable(
	ctx context.Context,
	opts *CreateParsedTableOpts,
) error

func (*SqliteProvider) CreateSession

func (p *SqliteProvider) CreateSession(
	ctx context.Context,
	opts *CreateSessionOpts,
) (string, Session, error)

func (*SqliteProvider) GetQueryService

func (p *SqliteProvider) GetQueryService() (QueryService, error)

func (*SqliteProvider) GetSessionRepository

func (p *SqliteProvider) GetSessionRepository() (SessionRepository, error)

type SqliteQueryService

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

func (*SqliteQueryService) QueryTable

func (qs *SqliteQueryService) QueryTable(
	ctx context.Context,
	payload *v1.QueryTableRequest,
) (*v1.QueryTableResponse, error)

type SqliteSession

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

func (*SqliteSession) CreateParsedTable

func (s *SqliteSession) CreateParsedTable(ctx context.Context, opts *CreateParsedTableOpts) error

func (*SqliteSession) WriteLogLinesBatch

func (s *SqliteSession) WriteLogLinesBatch(ctx context.Context, payload WriteLogLinesBatchPayload) error

type WriteLogLinesBatchPayload

type WriteLogLinesBatchPayload struct {
	Timestamp time.Time
	Lines     []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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