metamysql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHostname       string        = "127.0.0.1"
	DefaultPort           string        = "3306"
	DefaultUsername       string        = "bludgeon"
	DefaultPassword       string        = "bludgeon"
	DefaultDatabase       string        = "bludgeon"
	DefaultConnectTimeout time.Duration = 5 * time.Second
	DefaultQueryTimeout   time.Duration = 10 * time.Second
	DefaultParseTime      bool          = true
	DefaultDriver         string        = "mysql"
)

configuration defaults

View Source
const (
	DatabaseIsolation = sql.LevelSerializable
	LogAlias          = "Database"
)

common constants

View Source
const (
	ErrTimerNotFoundf     string = "timer with id, \"%s\", not found locally"
	ErrTimeSliceNotFoundf string = "timeSlice with id, \"%s\", not found locally"
	ErrTimerIsArchivedf   string = "timer with id, \"%s\", is archived"
	ErrNotImplemented     string = "not implemented"
	ErrDatabaseNil        string = "internal database pointer is nil"
	ErrDatabaseNotNil     string = "internal database pointer is not nil, reconnect or close to connect"
	ErrUpdateFailed       string = "update failed, no rows affected"
	ErrDeleteFailed       string = "delete failed, id not found"
	ErrQueryFailed        string = "query: \"%s\", failed"
	ErrStarted            string = "already started"
	ErrNotStarted         string = "not started"
)

error constants

View Source
const (
	TableTimer            string = "timer"
	TableSlice            string = "slice"
	TableTimerSliceActive string = "timer_slice_active"
	TableProject          string = "project"
	TableClient           string = "client"
	TableEmployee         string = "employee"
)

query constants

Variables

This section is empty.

Functions

func New

func New() interface {
	Owner
	meta.Owner
	meta.Timer
	meta.TimeSlice
}

Types

type Configuration

type Configuration struct {
	Hostname       string        `json:"Hostname"`       //hostame to user to access the database
	Port           string        `json:"Port"`           //port to connect to
	Username       string        `json:"Username"`       //username to authenticate with
	Password       string        `json:"Password"`       //password to authenticate with
	Database       string        `json:"Database"`       //database to connect to
	ConnectTimeout time.Duration `json:"ConnectTimeout"` //how long to wait to connect
	QueryTimeout   time.Duration `json:"QueryTimeout"`   //how long to wait when querying
	ParseTime      bool          `json:"ParseTime"`      //whether or not to parse time

}

Configuration is a struct that contains al lthe possible configuration for supported database drivers

func (*Configuration) Default

func (c *Configuration) Default()

func (*Configuration) FromEnv

func (c *Configuration) FromEnv(pwd string, envs map[string]string)

func (*Configuration) Validate

func (c *Configuration) Validate() (err error)

Validate is used to ensure that the values being configured make sense it's not necessarily to prevent a misconfiguration, but to use default values in the event a value doesn't exist

type Owner

type Owner interface {
	Initialize(config *Configuration) (err error)
}

Jump to

Keyboard shortcuts

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