service

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConn

type DBConn struct {
	DBEnv
	*sql.DB
	// contains filtered or unexported fields
}

func SetupDB

func SetupDB(env DBEnv, migrationDir embed.FS) (conn DBConn, err error)

func (*DBConn) ClearDB

func (s *DBConn) ClearDB() error

ClearDB migrates the DB down to an empty database. Uses the DB instance of the service.

func (*DBConn) FakeMigration

func (s *DBConn) FakeMigration(version int) error

FakeMigration fakes a specific version without migrating. Uses the DB instance of the service.

func (*DBConn) Migrate

func (s *DBConn) Migrate() error

Migrate migrates the DB up to the newest version Uses the DB instance of the service.

func (*DBConn) MigrateDown

func (s *DBConn) MigrateDown() error

MigrateDown migrates the DB down to an empty database. Uses the DB instance of the service.

type DBEnv

type DBEnv struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
	Schema   string
}

func LoadDBEnv

func LoadDBEnv(envs map[string]string) DBEnv

type HTTPEnv

type HTTPEnv struct {
	Port string
}

type HTTPServer

type HTTPServer struct {
	HTTPEnv
	// contains filtered or unexported fields
}

func SetupHTTP

func SetupHTTP(env HTTPEnv, handler http.Handler) HTTPServer

func (*HTTPServer) Serve

func (s *HTTPServer) Serve(ctx context.Context) (err error)

Jump to

Keyboard shortcuts

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