database

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Database

type Database struct {
	Q  *Queries
	DB *sql.DB
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(cfg *config.Config, logger *logger.Logger) *Database

func (*Database) Close

func (d *Database) Close() error

func (*Database) Init

func (d *Database) Init(ctx context.Context) error

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) GetAllBlackListCountries added in v0.8.0

func (q *Queries) GetAllBlackListCountries(ctx context.Context, db DBTX) ([]string, error)

func (*Queries) GetAllBlackListSubnets

func (q *Queries) GetAllBlackListSubnets(ctx context.Context, db DBTX) ([]string, error)

func (*Queries) GetAllWhiteListSubnets

func (q *Queries) GetAllWhiteListSubnets(ctx context.Context, db DBTX) ([]string, error)

func (*Queries) RemoveBlackListCountry added in v0.8.0

func (q *Queries) RemoveBlackListCountry(ctx context.Context, db DBTX, country string) error

func (*Queries) RemoveBlackListSubnet

func (q *Queries) RemoveBlackListSubnet(ctx context.Context, db DBTX, subnet string) error

func (*Queries) RemoveWhiteListSubnet

func (q *Queries) RemoveWhiteListSubnet(ctx context.Context, db DBTX, subnet string) error

func (*Queries) UpsertBlackListCountry added in v0.8.0

func (q *Queries) UpsertBlackListCountry(ctx context.Context, db DBTX, country string) error

func (*Queries) UpsertBlackListSubnet

func (q *Queries) UpsertBlackListSubnet(ctx context.Context, db DBTX, subnet string) error

func (*Queries) UpsertWhiteListSubnet

func (q *Queries) UpsertWhiteListSubnet(ctx context.Context, db DBTX, subnet string) error

Jump to

Keyboard shortcuts

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