db

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectEntryDB = "projects"
	TokenEntryDB   = "tokens"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateProjectEntry(ctx context.Context, pe ProjectEntry) error
	DeleteProjectEntry(ctx context.Context, project string) error
	ReadProjectEntry(ctx context.Context, project string) (ProjectEntry, error)
	CreateTokenEntry(ctx context.Context, token types.Token) error
	DeleteTokenEntry(ctx context.Context, token string) error
	ReadTokenEntry(ctx context.Context, token string) (TokenEntry, error)
	ListTokenEntries(ctx context.Context, project string) ([]TokenEntry, error)
	Health(ctx context.Context) error
}

Client allows for db crud operations

type ProjectEntry

type ProjectEntry struct {
	ProjectID  string `db:"project"`
	Repository string `db:"repository"`
}

type SQLClient

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

SQLClient allows for db crud operations using postgres db

func NewSQLClient

func NewSQLClient(host, database, user, password string, options map[string]string) (SQLClient, error)

func (SQLClient) CreateProjectEntry

func (d SQLClient) CreateProjectEntry(ctx context.Context, pe ProjectEntry) error

func (SQLClient) CreateTokenEntry added in v0.14.0

func (d SQLClient) CreateTokenEntry(ctx context.Context, token types.Token) error

func (SQLClient) DeleteProjectEntry

func (d SQLClient) DeleteProjectEntry(ctx context.Context, project string) error

func (SQLClient) DeleteTokenEntry added in v0.14.0

func (d SQLClient) DeleteTokenEntry(ctx context.Context, token string) error

func (SQLClient) Health added in v0.16.0

func (d SQLClient) Health(ctx context.Context) error

func (SQLClient) ListTokenEntries added in v0.14.0

func (d SQLClient) ListTokenEntries(ctx context.Context, project string) ([]TokenEntry, error)

func (SQLClient) ReadProjectEntry

func (d SQLClient) ReadProjectEntry(ctx context.Context, project string) (ProjectEntry, error)

func (SQLClient) ReadTokenEntry added in v0.14.0

func (d SQLClient) ReadTokenEntry(ctx context.Context, token string) (TokenEntry, error)

type TokenEntry added in v0.14.0

type TokenEntry struct {
	CreatedAt string `db:"created_at"`
	ExpiresAt string `db:"expires_at"`
	ProjectID string `db:"project"`
	TokenID   string `db:"token_id"`
}

func (TokenEntry) IsEmpty added in v0.15.0

func (t TokenEntry) IsEmpty() bool

IsEmpty returns whether a struct is empty.

Jump to

Keyboard shortcuts

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