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 ¶
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) 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)
}
Click to show internal directories.
Click to hide internal directories.