Documentation ¶
Index ¶
- Variables
- type DB
- func (db *DB) Close()
- func (db *DB) Count(path []string) int
- func (db *DB) Delete(path []string, m mod) error
- func (db *DB) DeleteBuckets(path []string, keys []string) error
- func (db *DB) DeleteKeys(path []string, keys []string) error
- func (db *DB) Find(path []string, id string, i interface{}) error
- func (db *DB) Get(path []string, key string) ([]byte, error)
- func (db *DB) List(path []string, dest interface{}, params ...Params) error
- func (db *DB) ListItems(path []string, params ...Params) (map[string][]byte, error)
- func (db *DB) ListKeys(path []string, keys [][]byte, dest interface{}) error
- func (db *DB) Save(path []string, m mod) error
- func (db *DB) SaveValue(path []string, id string, val []byte) error
- func (db *DB) Values(path []string, params ...Params) ([][]byte, error)
- type Errors
- type MID
- type Model
- func (m *Model) AddError(f string, t string)
- func (m *Model) GetErrors() Errors
- func (m *Model) ResetErrors()
- func (m *Model) SetErrors(e Errors)
- func (m *Model) Valid() bool
- func (m *Model) ValidateFloat32(f string, v, min, max float32)
- func (m *Model) ValidateFloat64(f string, v, min, max float64)
- func (m *Model) ValidateFormat(f, v, reg string)
- func (m *Model) ValidateInt(f string, v, min, max int)
- func (m *Model) ValidateInt64(f string, v, min, max int64)
- func (m *Model) ValidateLength(f, v string, min, max int)
- func (m *Model) ValidatePresence(f, v string)
- type Params
- type UpdateTime
Constants ¶
This section is empty.
Variables ¶
var Events = *pubsub.Hub
Events listener
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB
func (*DB) Delete ¶
Delete deletes model from database
m := Model{} db.Find([]string{"bucket"}, &m) db.Delete([]string{"bucket"}, &m)
func (*DB) DeleteBuckets ¶
DeleteBuckets deletes records from database by keys
db.DeleteBuckets([]string{"bucket"}, []string{"1","2","3"})
func (*DB) DeleteKeys ¶
DeleteKeys deletes records from database by keys
db.DeleteKeys([]string{"bucket"}, []string{"1","2","3"})
func (*DB) List ¶
List fills models slice with records from database
m := []Model{} db.List([]string{"bucket"}, &m)
load with params
db.List([]string{"bucket"}, &m, Params{Offset: 10, Limit: 30})
func (*DB) ListKeys ¶
ListKeys fills models slice with records by keys provided
m := []Model{} db.ListKeys([]string{"bucket"}, [][]byte{[]byte("1"),[]byte("2")}, &m)
func (*DB) Save ¶
Save saves model into database
m := Model{Name: "Model Name"} db.Save([]string{"bucket"}, &m)
type Model ¶
type Model struct { MID // contains filtered or unexported fields }
Model
func (*Model) ValidateFloat32 ¶
ValidateFloat32 validates float32 min, max. -1 for any
m.ValidateFloat32("number", 10.2, -1, 11)
func (*Model) ValidateFloat64 ¶
ValidateFloat64 validates float64 min, max. -1 for any
m.ValidateFloat64("number", 10.2, -1, 11)
func (*Model) ValidateFormat ¶
func (m *Model) ValidateFormat(f, v, reg string)
ValidateFormat validates string format with regex string
m.ValidateFormat("ip address", u.IP, `\A(\d{1,3}\.){3}\d{1,3}\z`)
func (*Model) ValidateInt ¶
ValidateInt validates int min, max. -1 for any
m.ValidateInt("number", 10, -1, 11) // max 18
func (*Model) ValidateInt64 ¶
ValidateInt64 validates int64 min, max. -1 for any
m.ValidateInt64("number", 10, 6, -1) // min 6
func (*Model) ValidateLength ¶
ValidateLength validates string min, max length. -1 for any
m.ValidateLength("password", m.Password, 6, 18) // min 6, max 18
func (*Model) ValidatePresence ¶
func (m *Model) ValidatePresence(f, v string)
ValidatePresence validates string for presence
m.ValidatePresence("Name", m.Name)
type UpdateTime ¶
UpdateTime struct for managing update time