database

package
v0.0.0-...-dd9aec0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MySQL = "mysql"
View Source
const Postgres = "postgres"

Variables

View Source
var RecordNotAffectedError = errors.New("record not affected")

Functions

This section is empty.

Types

type DatabaseHandler

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

func NewDatabaseHandler

func NewDatabaseHandler(migrator migrateAdapter, db Db) *DatabaseHandler

func (*DatabaseHandler) AddEntry

func (d *DatabaseHandler) AddEntry(lease controller.Lease) error

func (*DatabaseHandler) All

func (d *DatabaseHandler) All() ([]controller.Lease, error)

func (*DatabaseHandler) AllActive

func (d *DatabaseHandler) AllActive(duration int) ([]controller.Lease, error)

func (*DatabaseHandler) AllBlockSubnets

func (d *DatabaseHandler) AllBlockSubnets() ([]controller.Lease, error)

func (*DatabaseHandler) AllSingleIPSubnets

func (d *DatabaseHandler) AllSingleIPSubnets() ([]controller.Lease, error)

func (*DatabaseHandler) CheckDatabase

func (d *DatabaseHandler) CheckDatabase() error

func (*DatabaseHandler) DeleteEntry

func (d *DatabaseHandler) DeleteEntry(underlayIP string) error

func (*DatabaseHandler) LastRenewedAtForUnderlayIP

func (d *DatabaseHandler) LastRenewedAtForUnderlayIP(underlayIP string) (int64, error)

func (*DatabaseHandler) LeaseForUnderlayIP

func (d *DatabaseHandler) LeaseForUnderlayIP(underlayIP string) (*controller.Lease, error)

func (*DatabaseHandler) Migrate

func (d *DatabaseHandler) Migrate() (int, error)

func (*DatabaseHandler) OldestExpiredBlockSubnet

func (d *DatabaseHandler) OldestExpiredBlockSubnet(expirationTime int) (*controller.Lease, error)

func (*DatabaseHandler) OldestExpiredSingleIP

func (d *DatabaseHandler) OldestExpiredSingleIP(expirationTime int) (*controller.Lease, error)

func (*DatabaseHandler) RenewLeaseForUnderlayIP

func (d *DatabaseHandler) RenewLeaseForUnderlayIP(underlayIP string) error

type Db

type Db interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Rebind(query string) string
	Query(query string, args ...interface{}) (*sql.Rows, error)
	QueryRow(query string, args ...interface{}) *sql.Row
	DriverName() string
	RawConnection() *sqlx.DB
}

type MigrateAdapter

type MigrateAdapter struct {
}

func (*MigrateAdapter) Exec

type Migrator

type Migrator struct {
	DatabaseMigrator              databaseMigrator
	MaxMigrationAttempts          int
	MigrationAttemptSleepDuration time.Duration
	Logger                        lager.Logger
}

func (*Migrator) TryMigrations

func (m *Migrator) TryMigrations() error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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