Documentation
¶
Index ¶
- Constants
- func NewPgxPool(ctx context.Context, connUrl string) (*pgxpool.Pool, error)
- type AWSAdapter
- func (a *AWSAdapter) DeleteObjects(ctx context.Context, bucket string, objects []string, waiter interface{}) error
- func (a *AWSAdapter) GetObject(ctx context.Context, bucket string, key string) (io.Reader, error)
- func (a *AWSAdapter) GetSecret(ctx context.Context, arn string, name string) (string, error)
- func (a *AWSAdapter) ListObjects(ctx context.Context, bucket string, prefix string, pager interface{}) ([]string, error)
- func (a *AWSAdapter) ObjectExists(ctx context.Context, bucket string, key string) (int, error)
- func (a *AWSAdapter) PutObject(ctx context.Context, data io.Reader, bucket string, key string) error
- type AWSOpt
- type CmdAdapter
- type Command
- type ErrAttachSession
- type ErrAuthCode
- type ErrCollectRows
- type ErrConnect
- type ErrCreateTopic
- type ErrDeleteObjects
- type ErrDriveClient
- type ErrDriveUpload
- type ErrExecQuery
- type ErrGetSecret
- type ErrInvalidPath
- type ErrInvalidStmt
- type ErrListObjects
- type ErrListTopics
- type ErrNewSession
- type ErrNewWindow
- type ErrNilAWSClient
- type ErrNilClient
- type ErrNilConfig
- type ErrNilDrive
- type ErrNilPgxPool
- type ErrNilPgxTx
- type ErrNilToken
- type ErrNotFound
- type ErrOpenFile
- type ErrProtoMarshal
- type ErrPutObject
- type ErrQueryRow
- type ErrReadCfg
- type ErrS3Output
- type ErrSelectWindow
- type ErrSendKeys
- type ErrTypeCast
- type ErrUnmarshalToml
- type ErrWebToken
- type GoogleAdapter
- type GoogleOpt
- type KafkaAdapter
- type KafkaConsumer
- type KafkaOpt
- type ListObjectsV2Pager
- type ObjectNotExistsWaiter
- type PgxPool
- type PgxTx
- type PostgresAdapter
- func (a *PostgresAdapter[T]) Commit(ctx context.Context) error
- func (a *PostgresAdapter[T]) ConnectionPool() PgxPool
- func (a *PostgresAdapter[T]) Delete(ctx context.Context, sql string, args map[string]interface{}) error
- func (a *PostgresAdapter[T]) Exec(ctx context.Context, sql string, args map[string]interface{}) (int64, error)
- func (a *PostgresAdapter[T]) Insert(ctx context.Context, sql string, args map[string]interface{}) (int, error)
- func (a *PostgresAdapter[T]) NewTransactionAdapter(ctx context.Context) (*PostgresAdapter[T], error)
- func (a *PostgresAdapter[T]) Rollback(ctx context.Context) error
- func (a *PostgresAdapter[T]) RowExists(ctx context.Context, sql string, args map[string]interface{}) (bool, error)
- func (a *PostgresAdapter[T]) Select(ctx context.Context, sql string, args map[string]interface{}) ([]T, error)
- type PostgresOpt
- type S3Client
- type SecretsManagerClient
- type TmuxAdapter
- func (a *TmuxAdapter) AttachSession(ctx context.Context, session string) error
- func (a *TmuxAdapter) HasSession(ctx context.Context, session string) int
- func (a *TmuxAdapter) NewSession(ctx context.Context, name string) error
- func (a *TmuxAdapter) NewWindow(ctx context.Context, session string, name string) error
- func (a *TmuxAdapter) SelectWindow(ctx context.Context, session string, window string) error
- func (a *TmuxAdapter) SendKeys(ctx context.Context, cmd []string, session string, window string) error
- type TomlAdapter
- type ZipAdapter
Constants ¶
const ( S3ObjectNotExists int = iota S3ObjectExists )
const ( SelectKeyword string = "select" InsertKeyword string = "insert" DeleteKeyword string = "delete" )
const ( TmuxSessionExists int = iota TmuxSessionNotExists )
const ( TmuxEnterCmd string = "C-m" TmuxHasSessionCmd string = "has-session" TmuxNewSessionCmd string = "new-session" TmuxNewWindowCmd string = "new-window" TmuxSelectWindowCmd string = "select-window" TmuxAttachCmd string = "attach-session" TmuxSendKeysCmd string = "send-keys" )
const Alias string = "tmux"
const ExDeleteQuery string = `
DELETE FROM table
WHERE id = @id
`
const ExInsertQuery string = `
INSERT INTO table (
data
) VALUES (
@data
) RETURNING id
`
const ExRowExistsQuery string = `
SELECT id
FROM table
WHERE id = @id
`
const ExSelectQuery string = `
SELECT *
FROM table
WHERE id = @id
`
const (
MaxDeleteKeys int = 1000
)
const (
MaxPollFetches int = 1000
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AWSAdapter ¶
type AWSAdapter struct {
// contains filtered or unexported fields
}
func NewAWSAdapter ¶
func (*AWSAdapter) DeleteObjects ¶
func (*AWSAdapter) ListObjects ¶
func (*AWSAdapter) ObjectExists ¶
type AWSOpt ¶
type AWSOpt func(a *AWSAdapter)
func WithAWSSpanAttrs ¶ added in v0.0.7
func WithS3Client ¶
func WithSecretsManagerClient ¶ added in v0.0.7
func WithSecretsManagerClient(client SecretsManagerClient) AWSOpt
type CmdAdapter ¶ added in v0.0.3
type CmdAdapter struct{}
func NewCmdAdapter ¶ added in v0.0.3
func NewCmdAdapter() *CmdAdapter
type ErrAttachSession ¶ added in v0.0.3
type ErrAttachSession struct {
// contains filtered or unexported fields
}
func (*ErrAttachSession) Error ¶ added in v0.0.3
func (e *ErrAttachSession) Error() string
type ErrAuthCode ¶
type ErrAuthCode struct {
// contains filtered or unexported fields
}
func (*ErrAuthCode) Error ¶
func (e *ErrAuthCode) Error() string
type ErrCollectRows ¶ added in v0.0.3
type ErrCollectRows struct {
// contains filtered or unexported fields
}
func (*ErrCollectRows) Error ¶ added in v0.0.3
func (e *ErrCollectRows) Error() string
type ErrConnect ¶ added in v0.0.3
type ErrConnect struct {
// contains filtered or unexported fields
}
func (*ErrConnect) Error ¶ added in v0.0.3
func (e *ErrConnect) Error() string
type ErrCreateTopic ¶ added in v0.0.2
type ErrCreateTopic struct {
// contains filtered or unexported fields
}
func (*ErrCreateTopic) Error ¶ added in v0.0.2
func (e *ErrCreateTopic) Error() string
type ErrDeleteObjects ¶
type ErrDeleteObjects struct {
// contains filtered or unexported fields
}
func (*ErrDeleteObjects) Error ¶
func (e *ErrDeleteObjects) Error() string
type ErrDriveClient ¶
type ErrDriveClient struct {
// contains filtered or unexported fields
}
func (*ErrDriveClient) Error ¶
func (e *ErrDriveClient) Error() string
type ErrDriveUpload ¶
type ErrDriveUpload struct {
// contains filtered or unexported fields
}
func (*ErrDriveUpload) Error ¶
func (e *ErrDriveUpload) Error() string
type ErrExecQuery ¶ added in v0.0.3
type ErrExecQuery struct {
// contains filtered or unexported fields
}
func (*ErrExecQuery) Error ¶ added in v0.0.3
func (e *ErrExecQuery) Error() string
type ErrGetSecret ¶
type ErrGetSecret struct {
// contains filtered or unexported fields
}
func (*ErrGetSecret) Error ¶
func (e *ErrGetSecret) Error() string
type ErrInvalidPath ¶
type ErrInvalidPath struct {
// contains filtered or unexported fields
}
func (*ErrInvalidPath) Error ¶
func (e *ErrInvalidPath) Error() string
type ErrInvalidStmt ¶ added in v0.0.7
type ErrInvalidStmt struct{}
func (*ErrInvalidStmt) Error ¶ added in v0.0.7
func (e *ErrInvalidStmt) Error() string
type ErrListObjects ¶
type ErrListObjects struct {
// contains filtered or unexported fields
}
func (*ErrListObjects) Error ¶
func (e *ErrListObjects) Error() string
type ErrListTopics ¶ added in v0.0.2
type ErrListTopics struct {
// contains filtered or unexported fields
}
func (*ErrListTopics) Error ¶ added in v0.0.2
func (e *ErrListTopics) Error() string
type ErrNewSession ¶ added in v0.0.3
type ErrNewSession struct {
// contains filtered or unexported fields
}
func (*ErrNewSession) Error ¶ added in v0.0.3
func (e *ErrNewSession) Error() string
type ErrNewWindow ¶ added in v0.0.3
type ErrNewWindow struct {
// contains filtered or unexported fields
}
func (*ErrNewWindow) Error ¶ added in v0.0.3
func (e *ErrNewWindow) Error() string
type ErrNilAWSClient ¶
type ErrNilAWSClient struct {
// contains filtered or unexported fields
}
func (*ErrNilAWSClient) Error ¶
func (e *ErrNilAWSClient) Error() string
type ErrNilClient ¶
type ErrNilClient struct{}
func (*ErrNilClient) Error ¶
func (e *ErrNilClient) Error() string
type ErrNilConfig ¶
type ErrNilConfig struct{}
func (*ErrNilConfig) Error ¶
func (e *ErrNilConfig) Error() string
type ErrNilDrive ¶
type ErrNilDrive struct{}
func (*ErrNilDrive) Error ¶
func (e *ErrNilDrive) Error() string
type ErrNilPgxPool ¶ added in v0.0.3
type ErrNilPgxPool struct{}
func (*ErrNilPgxPool) Error ¶ added in v0.0.3
func (e *ErrNilPgxPool) Error() string
type ErrNilPgxTx ¶ added in v0.0.3
type ErrNilPgxTx struct{}
func (*ErrNilPgxTx) Error ¶ added in v0.0.3
func (e *ErrNilPgxTx) Error() string
type ErrNilToken ¶
type ErrNilToken struct{}
func (*ErrNilToken) Error ¶
func (e *ErrNilToken) Error() string
type ErrNotFound ¶ added in v0.0.3
type ErrNotFound struct {
// contains filtered or unexported fields
}
func (*ErrNotFound) Error ¶ added in v0.0.3
func (e *ErrNotFound) Error() string
type ErrOpenFile ¶
type ErrOpenFile struct {
// contains filtered or unexported fields
}
func (*ErrOpenFile) Error ¶
func (e *ErrOpenFile) Error() string
type ErrProtoMarshal ¶ added in v0.0.2
type ErrProtoMarshal struct {
// contains filtered or unexported fields
}
func (*ErrProtoMarshal) Error ¶ added in v0.0.2
func (e *ErrProtoMarshal) Error() string
type ErrPutObject ¶ added in v0.0.7
type ErrPutObject struct {
// contains filtered or unexported fields
}
func (*ErrPutObject) Error ¶ added in v0.0.7
func (e *ErrPutObject) Error() string
type ErrQueryRow ¶ added in v0.0.3
type ErrQueryRow struct {
// contains filtered or unexported fields
}
func (*ErrQueryRow) Error ¶ added in v0.0.3
func (e *ErrQueryRow) Error() string
type ErrReadCfg ¶ added in v0.0.3
type ErrReadCfg struct {
// contains filtered or unexported fields
}
func (*ErrReadCfg) Error ¶ added in v0.0.3
func (e *ErrReadCfg) Error() string
type ErrS3Output ¶
type ErrS3Output struct {
// contains filtered or unexported fields
}
func (*ErrS3Output) Error ¶
func (e *ErrS3Output) Error() string
type ErrSelectWindow ¶ added in v0.0.3
type ErrSelectWindow struct {
// contains filtered or unexported fields
}
func (*ErrSelectWindow) Error ¶ added in v0.0.3
func (e *ErrSelectWindow) Error() string
type ErrSendKeys ¶ added in v0.0.3
type ErrSendKeys struct {
// contains filtered or unexported fields
}
func (*ErrSendKeys) Error ¶ added in v0.0.3
func (e *ErrSendKeys) Error() string
type ErrTypeCast ¶
type ErrTypeCast struct {
// contains filtered or unexported fields
}
func (*ErrTypeCast) Error ¶
func (e *ErrTypeCast) Error() string
type ErrUnmarshalToml ¶ added in v0.0.3
type ErrUnmarshalToml struct {
// contains filtered or unexported fields
}
func (*ErrUnmarshalToml) Error ¶ added in v0.0.3
func (e *ErrUnmarshalToml) Error() string
type ErrWebToken ¶
type ErrWebToken struct {
// contains filtered or unexported fields
}
func (*ErrWebToken) Error ¶
func (e *ErrWebToken) Error() string
type GoogleAdapter ¶
type GoogleAdapter struct {
// contains filtered or unexported fields
}
func NewGoogleAdapter ¶
func NewGoogleAdapter(tracer trace.Tracer, opts ...GoogleOpt) (*GoogleAdapter, error)
type GoogleOpt ¶
type GoogleOpt func(a *GoogleAdapter) error
func WithDriveConn ¶
func WithGoogleSpanAttrs ¶ added in v0.0.7
type KafkaAdapter ¶ added in v0.0.2
type KafkaAdapter struct {
// contains filtered or unexported fields
}
func NewKafkaAdapter ¶ added in v0.0.2
func NewKafkaAdapter(logger *slog.Logger, tracer trace.Tracer, opts ...KafkaOpt) (*KafkaAdapter, error)
NewKafkaAdapter creates a new kafka adapter. Adapters should be configured to either produce or consume, but not both
func (*KafkaAdapter) Close ¶ added in v0.0.2
func (a *KafkaAdapter) Close() error
Close closes the kafka client
func (*KafkaAdapter) Consume ¶ added in v0.0.2
func (a *KafkaAdapter) Consume(ctx context.Context, consumer KafkaConsumer)
Consume uses the supplied consumer to process kafka records from the configured topic
func (*KafkaAdapter) CreateTopic ¶ added in v0.0.2
func (a *KafkaAdapter) CreateTopic(ctx context.Context, topic string) error
CreateTopic creates a kafka topic
func (*KafkaAdapter) Send ¶ added in v0.0.2
func (a *KafkaAdapter) Send(ctx context.Context, record protoreflect.ProtoMessage) error
Send sends the supplied kafka record to the configured topic
type KafkaConsumer ¶ added in v0.0.2
type KafkaOpt ¶ added in v0.0.2
type KafkaOpt func(a *KafkaAdapter) error
func WithConsumer ¶ added in v0.0.2
func WithKafkaSpanAttrs ¶ added in v0.0.7
func WithProducer ¶ added in v0.0.2
type ListObjectsV2Pager ¶
type ObjectNotExistsWaiter ¶
type ObjectNotExistsWaiter interface {
Wait(ctx context.Context, params *s3.HeadObjectInput, maxWaitDur time.Duration, optFns ...func(*s3.ObjectNotExistsWaiterOptions)) error
}
type PgxPool ¶ added in v0.0.3
type PgxPool interface {
Begin(ctx context.Context) (pgx.Tx, error)
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
}
type PostgresAdapter ¶ added in v0.0.3
type PostgresAdapter[T any] struct { // contains filtered or unexported fields }
func NewPostgresAdapter ¶ added in v0.0.3
func NewPostgresAdapter[T any](pool PgxPool, logger *slog.Logger, tracer trace.Tracer, opts ...PostgresOpt[T]) *PostgresAdapter[T]
NewPostgresAdapter creates a new PostgresAdapter
func (*PostgresAdapter[T]) Commit ¶ added in v0.0.3
func (a *PostgresAdapter[T]) Commit(ctx context.Context) error
Commit commits the transaction after first checking if the context has been canceled
func (*PostgresAdapter[T]) ConnectionPool ¶ added in v0.0.3
func (a *PostgresAdapter[T]) ConnectionPool() PgxPool
ConnectionPool returns the underlying pgxpool
func (*PostgresAdapter[T]) Delete ¶ added in v0.0.3
func (a *PostgresAdapter[T]) Delete(ctx context.Context, sql string, args map[string]interface{}) error
Delete deletes the supplied row
func (*PostgresAdapter[T]) Exec ¶ added in v0.0.7
func (a *PostgresAdapter[T]) Exec(ctx context.Context, sql string, args map[string]interface{}) (int64, error)
Exec executes the supplied sql statement and returns the number of rows affected
func (*PostgresAdapter[T]) Insert ¶ added in v0.0.3
func (a *PostgresAdapter[T]) Insert(ctx context.Context, sql string, args map[string]interface{}) (int, error)
Insert creates a new row returns the id
func (*PostgresAdapter[T]) NewTransactionAdapter ¶ added in v0.0.3
func (a *PostgresAdapter[T]) NewTransactionAdapter(ctx context.Context) (*PostgresAdapter[T], error)
NewTransactionAdapter creates an adapter for executing transactions
func (*PostgresAdapter[T]) Rollback ¶ added in v0.0.3
func (a *PostgresAdapter[T]) Rollback(ctx context.Context) error
Rollback initiates a transaction rollback
type PostgresOpt ¶ added in v0.0.3
type PostgresOpt[T any] func(a *PostgresAdapter[T])
func WithPgxTx ¶ added in v0.0.3
func WithPgxTx[T any](tx PgxTx) PostgresOpt[T]
WithPgxTx sets the transaction adapter
func WithPostgresSpanAttrs ¶ added in v0.0.7
func WithPostgresSpanAttrs[T any](attrs ...attribute.KeyValue) PostgresOpt[T]
type S3Client ¶
type S3Client interface {
HeadObject(ctx context.Context, params *s3.HeadObjectInput, optFns ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
DeleteObjects(ctx context.Context, params *s3.DeleteObjectsInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error)
}
type SecretsManagerClient ¶
type SecretsManagerClient interface {
GetSecretValue(ctx context.Context, params *secretsmanager.GetSecretValueInput, optFns ...func(*secretsmanager.Options)) (*secretsmanager.GetSecretValueOutput, error)
}
type TmuxAdapter ¶ added in v0.0.3
type TmuxAdapter struct {
// contains filtered or unexported fields
}
func NewTmuxAdapter ¶ added in v0.0.3
func NewTmuxAdapter(adapter Command) *TmuxAdapter
NewTmuxAdapter creates a tmux adapter
func (*TmuxAdapter) AttachSession ¶ added in v0.0.3
func (a *TmuxAdapter) AttachSession(ctx context.Context, session string) error
AttachSession attempts attaching to a tmux session
func (*TmuxAdapter) HasSession ¶ added in v0.0.3
func (a *TmuxAdapter) HasSession(ctx context.Context, session string) int
HasSession checks for an already existing tmux session
func (*TmuxAdapter) NewSession ¶ added in v0.0.3
func (a *TmuxAdapter) NewSession(ctx context.Context, name string) error
NewSession creates a new tmux session
func (*TmuxAdapter) SelectWindow ¶ added in v0.0.3
SelectWindow selects a tmux window
type TomlAdapter ¶ added in v0.0.3
type TomlAdapter[T any] struct { Config T }
func NewTomlAdapter ¶ added in v0.0.3
func NewTomlAdapter[T any]() *TomlAdapter[T]
NewTomlAdapter creates a toml adapter
func (*TomlAdapter[T]) LoadConfig ¶ added in v0.0.3
func (a *TomlAdapter[T]) LoadConfig(filename string) error
LoadConfig attempts to read a toml file in the current directory and returns a config
type ZipAdapter ¶
type ZipAdapter struct{}
func NewZipAdapter ¶
func NewZipAdapter() *ZipAdapter