Documentation
¶
Index ¶
- func Connect() *sql.DB
- type Configure
- type MongoDB
- type MongoHelper
- func (mongoHelper MongoHelper) Insert(ob interface{}) error
- func (mongoHelper MongoHelper) QueryAll(queryCondition interface{}, ob []interface{}) (result []interface{})
- func (mongoHelper MongoHelper) QueryOne(queryCondition interface{}, ob interface{}) (code int, result interface{})
- func (mongoHelper MongoHelper) Update(colQuerier interface{}, update interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configure ¶
type Configure struct { Mysqldbhost string `json:"mysqldbhost"` Mysqldbport string `json:"mysqldbport"` Mysqldbname string `json:"mysqldbname"` Mysqldbusername string `json:"mysqldbusername"` Mysqldbpassword string `json:"mysqldbpassword"` }
Configure : define mysql struct
type MongoDB ¶
type MongoDB struct { Mongohost string `json:"mongohost"` Mongoport string `json:"mongoport"` DBName string `json:"dbname"` }
MongoDB define mongo db instance
type MongoHelper ¶
MongoHelper is the API client that performs all operations
func NewMongoHelper ¶
func NewMongoHelper() MongoHelper
NewMongoHelper initializes a new mongo helper object.
func (MongoHelper) Insert ¶
func (mongoHelper MongoHelper) Insert(ob interface{}) error
Insert insert one record in db
func (MongoHelper) QueryAll ¶
func (mongoHelper MongoHelper) QueryAll(queryCondition interface{}, ob []interface{}) (result []interface{})
QueryAll is query all record by condition, return a interface.
func (MongoHelper) QueryOne ¶
func (mongoHelper MongoHelper) QueryOne(queryCondition interface{}, ob interface{}) (code int, result interface{})
QueryOne query info by condition return one record.
func (MongoHelper) Update ¶
func (mongoHelper MongoHelper) Update(colQuerier interface{}, update interface{}) bool
Update is update the entry by latest changed. args: cName to set the collection name. colQuerier to set the query collection condition. update to set the update object.
Click to show internal directories.
Click to hide internal directories.