infrastructure

package
v0.0.0-...-d1be498 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverNameUnknown rdb.DriverName = ""
	DriverNameMySQL   rdb.DriverName = "mysql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLConfig

type MySQLConfig struct {
	Host     string `envconfig:"HOST" required:"true"`
	User     string `envconfig:"USER" required:"true"`
	Database string `envconfig:"DATABASE" required:"true"`
	Password string `envconfig:"PASSWORD" required:"true"`
	Port     int    `envconfig:"PORT" default:"3306"`
	MaxConns int    `envconfig:"MAX_CONNS" default:"1"`
}

func LoadMySQLConfig

func LoadMySQLConfig() (*MySQLConfig, error)

func (*MySQLConfig) GetDSN

func (c *MySQLConfig) GetDSN() string

func (*MySQLConfig) GetDriverName

func (c *MySQLConfig) GetDriverName() rdb.DriverName

func (*MySQLConfig) GetMaxConns

func (c *MySQLConfig) GetMaxConns() int

type RDB

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

func OpenRDB

func OpenRDB(conf rdb.Config) (*RDB, error)

func (*RDB) Begin

func (db *RDB) Begin() (rdb.Transaction, error)

type RDBTransaction

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

func (*RDBTransaction) Commit

func (rt *RDBTransaction) Commit() error

func (*RDBTransaction) Exec

func (rt *RDBTransaction) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*RDBTransaction) Get

func (rt *RDBTransaction) Get(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*RDBTransaction) NamedExec

func (rt *RDBTransaction) NamedExec(ctx context.Context, query string, arg interface{}) (sql.Result, error)

func (*RDBTransaction) Rollback

func (rt *RDBTransaction) Rollback() error

func (*RDBTransaction) Select

func (rt *RDBTransaction) Select(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type S3Client

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

func NewS3Client

func NewS3Client(bucket string, conf aws.Config) *S3Client

func (S3Client) Get

func (c S3Client) Get(ctx context.Context, path string) (io.ReadCloser, error)

func (S3Client) Remove

func (c S3Client) Remove(ctx context.Context, path string) error

func (S3Client) Save

func (c S3Client) Save(ctx context.Context, path string, mime storage.MimeType, body []byte) error

type S3Config

type S3Config struct {
	JWKBucket string `envconfig:"JWK_BUCKET" required:"true"`
}

func LoadS3Config

func LoadS3Config() (*S3Config, error)

Jump to

Keyboard shortcuts

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