storage

package
v0.0.0-...-76aaa9a Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseHandler

type DatabaseHandler interface {
	// ExecContext executes a query with parameters
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	// QueryContext queries multiple rows
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	// QueryRowContext queries a single row
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
	// BeginTx begins a transaction
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
	// Close connection
	Close() error
	// Ping can be used to connection health
	Ping() error
}

DatabaseHandler defines an interface for database storage operations

type MinIOStorage

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

func NewMinIOStorage

func NewMinIOStorage(config *config.Config) (*MinIOStorage, error)

NewMinIOStorage creates new MinIO storage instance

func (*MinIOStorage) Close

func (m *MinIOStorage) Close() error

func (*MinIOStorage) CreateBucket

func (m *MinIOStorage) CreateBucket(ctx context.Context, webhook types.Webhook) error

func (*MinIOStorage) DeleteObject

func (m *MinIOStorage) DeleteObject(ctx context.Context, bucketName, objectName string) error

func (*MinIOStorage) GetObject

func (m *MinIOStorage) GetObject(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)

func (*MinIOStorage) GetObjects

func (m *MinIOStorage) GetObjects(ctx context.Context, bucket string) ([]string, error)

func (*MinIOStorage) GetPresignedURL

func (m *MinIOStorage) GetPresignedURL(ctx context.Context, bucketName, objectName string, expires time.Duration) (string, error)

func (*MinIOStorage) PutObject

func (m *MinIOStorage) PutObject(ctx context.Context, bucketName, payload string) error

type ObjectStoreHandler

type ObjectStoreHandler interface {
	CreateBucket(ctx context.Context, webhook types.Webhook) error
	// PutObject uploads a file to object storage
	PutObject(ctx context.Context, bucketName, payload string) error
	// GetObject downloads a file from object storage
	GetObject(ctx context.Context, bucketName, objectName string) (io.ReadCloser, error)
	// GetObjects returns a string array of all bucket contents
	GetObjects(ctx context.Context, bucketName string) ([]string, error)
	// DeleteObject deletes a file from object storage
	DeleteObject(ctx context.Context, bucketName, objectName string) error
	// GetPresignedURL returns temporary URL for object
	GetPresignedURL(ctx context.Context, bucketName, objectName string, expires time.Duration) (string, error)
	// Close connection
	Close() error
}

ObjectStoreHandler defines an interface for object storage operations

type PostgresDB

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

PostgresDB implements Database interface

func NewPostgresDB

func NewPostgresDB(config *config.Config) (*PostgresDB, error)

NewPostgresDB creates new PostgreSQL database instance

func (*PostgresDB) BeginTx

func (p *PostgresDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

func (*PostgresDB) Close

func (p *PostgresDB) Close() error

func (*PostgresDB) ExecContext

func (p *PostgresDB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*PostgresDB) Ping

func (p *PostgresDB) Ping() error

func (*PostgresDB) QueryContext

func (p *PostgresDB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*PostgresDB) QueryRowContext

func (p *PostgresDB) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

Jump to

Keyboard shortcuts

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