mysql

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Schema string

Schema contains the MySQL schema for the DEP storage.

Functions

This section is empty.

Types

type MySQLStorage

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

MySQLStorage implements a storage.AllStorage using MySQL.

func New

func New(opts ...Option) (*MySQLStorage, error)

New creates and returns a new MySQLStorage.

func (*MySQLStorage) RetrieveAssignerProfile

func (s *MySQLStorage) RetrieveAssignerProfile(ctx context.Context, name string) (profileUUID string, modTime time.Time, err error)

RetrieveAssignerProfile reads the assigner profile UUID and its timestamp for name DEP name.

Returns an empty profile UUID if it does not exist.

func (*MySQLStorage) RetrieveAuthTokens

func (s *MySQLStorage) RetrieveAuthTokens(ctx context.Context, name string) (*client.OAuth1Tokens, error)

RetrieveAuthTokens reads the DEP OAuth tokens for name DEP name.

func (*MySQLStorage) RetrieveConfig

func (s *MySQLStorage) RetrieveConfig(ctx context.Context, name string) (*client.Config, error)

RetrieveConfig reads the JSON DEP config of a DEP name.

Returns (nil, nil) if the DEP name does not exist, or if the config for the DEP name does not exist.

func (*MySQLStorage) RetrieveCursor

func (s *MySQLStorage) RetrieveCursor(ctx context.Context, name string) (string, error)

RetrieveCursor reads the reads the DEP fetch and sync cursor for name DEP name.

Returns an empty cursor if the cursor does not exist.

func (*MySQLStorage) RetrieveTokenPKI

func (s *MySQLStorage) RetrieveTokenPKI(ctx context.Context, name string) (pemCert []byte, pemKey []byte, err error)

RetrieveTokenPKI reads the PEM bytes for the DEP token exchange certificate and private key using name DEP name.

func (*MySQLStorage) StoreAssignerProfile

func (s *MySQLStorage) StoreAssignerProfile(ctx context.Context, name string, profileUUID string) error

StoreAssignerProfile saves the assigner profile UUID for name DEP name.

func (*MySQLStorage) StoreAuthTokens

func (s *MySQLStorage) StoreAuthTokens(ctx context.Context, name string, tokens *client.OAuth1Tokens) error

StoreAuthTokens saves the DEP OAuth tokens for the DEP name.

func (*MySQLStorage) StoreConfig

func (s *MySQLStorage) StoreConfig(ctx context.Context, name string, config *client.Config) error

StoreConfig saves the DEP config for name DEP name.

func (*MySQLStorage) StoreCursor

func (s *MySQLStorage) StoreCursor(ctx context.Context, name, cursor string) error

StoreCursor saves the DEP fetch and sync cursor for name DEP name.

func (*MySQLStorage) StoreTokenPKI

func (s *MySQLStorage) StoreTokenPKI(ctx context.Context, name string, pemCert []byte, pemKey []byte) error

StoreTokenPKI stores the PEM bytes in pemCert and pemKey for name DEP name.

type Option

type Option func(*config)

Option allows configuring a MySQLStorage.

func WithDB

func WithDB(db *sql.DB) Option

WithDB sets a custom MySQL *sql.DB to the storage.

If set, driver passed via WithDriver is ignored.

func WithDSN

func WithDSN(dsn string) Option

WithDSN sets the storage MySQL data source name.

func WithDriver

func WithDriver(driver string) Option

WithDriver sets a custom MySQL driver for the storage.

Default driver is "mysql". Value is ignored if WithDB is used.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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