Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultDBConfig = Config{ WhatDB{ CurrentBackend: "couchdb", CurrentEnv: "dev", Backends: map[string]WhatEnv{ "couchdb": { "dev": &ConfigItem{ Hosts: []string{ "localhost:5984", }, Username: "admin", Password: "safe,2017", Database: "test", }, }, }, Debug: true, }, nil, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { DB WhatDB `json:"db" yaml:"db"` // contains filtered or unexported fields }
func (*Config) GetBackend ¶
func (*Config) SetBackend ¶
type ConfigItem ¶
type ConfigItem struct { Hosts []string `json:"hosts" yaml:"hosts"` Username string `json:"username,omitempty" yaml:"username,omitempty"` Password string `json:"password,omitempty" yaml:"password,omitempty"` Database string `json:"database,omitempty" yaml:"database,omitempty"` ReplicaSet string `json:"replicaSet,omitempty" yaml:"replicaSet,omitempty"` DisableInitialHostLookup bool `json:"disableInitialHostLookup,omitempty" yaml:"disableInitialHostLookup,omitempty"` Description string `json:"desc,omitempty" yaml:"desc,omitempty"` // contains filtered or unexported fields }
func (*ConfigItem) GetEcho ¶
func (s *ConfigItem) GetEcho() *echo.Echo
func (*ConfigItem) SetEcho ¶
func (s *ConfigItem) SetEcho(e *echo.Echo)
type DbBackend ¶
type DbBackend interface { // must use the defer pattern: // defer session.Close() Open() (session DbSession) // no use CloseAll() }
type DbCRUD ¶
type DbCRUD interface { Insert() (rows int, err error) Update() (rows int, err error) // Get a single record by PK Get() (err error) Delete() bool Exists() bool // if condition checked then skip (or update the Model) // if unchecked (not exists), insert as a new record. InsertOrUpdate(conditions ...string) bool // Get a single record by conditions and params GetOne(conditions string, params ...interface{}) bool Query(results *[]interface{}, conditions string, params ...interface{}) *[]interface{} UpdateWith(conditionFields ...string) bool ExistsWith(conditionFields ...string) bool ExistsBy(conditions string, params ...interface{}) bool DeleteBy(conditions string, params ...interface{}) bool }
type WhatEnv ¶
type WhatEnv map[string]*ConfigItem
Click to show internal directories.
Click to hide internal directories.