Documentation ¶
Index ¶
- func MakeMongoFilter(c Criteria) bson.D
- func MakeMongoUpdate(val Updates) bson.M
- func NewMongoFindOneOptions(c Criteria) *options.FindOneOptions
- func NewMongoFindOptions(c Criteria) *options.FindOptions
- type Client
- type Collection
- type Config
- type Criteria
- type Database
- type Filter
- type PagingInfo
- type PagingParam
- type Sort
- type Update
- type Updates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMongoFilter ¶
MakeMongoFilter return sort value for mongo.
func NewMongoFindOneOptions ¶
func NewMongoFindOneOptions(c Criteria) *options.FindOneOptions
NewMongoFindOneOptions return options for mongo.
func NewMongoFindOptions ¶
func NewMongoFindOptions(c Criteria) *options.FindOptions
NewMongoFindOptions return options for mongo.
Types ¶
type Client ¶
type Client interface { Database(string) Database Connect() error Disconnect() error Ping() error StartSession() (mongo.Session, error) }
Client interface.
type Collection ¶
type Collection interface { InsertOne(doc interface{}) (interface{}, error) InsertMany(docs []interface{}) ([]interface{}, error) DeleteOne(filter interface{}) (int64, error) DeleteOneByCriteria(criteria Criteria) (int64, error) DeleteMany(filter interface{}) (int64, error) DeleteManyByCriteria(criteria Criteria) (int64, error) UpdateOne(filter interface{}, update interface{}) (int64, error) UpdateOneByCriteria(criteria Criteria, update interface{}) (int64, error) UpdatePartialOneByCriteria(criteria Criteria, updates Updates) (int64, error) UpdateMany(filter interface{}, update interface{}) (int64, error) UpdateManyByCriteria(criteria Criteria, update interface{}) (int64, error) UpdatePartialManyByCriteria(criteria Criteria, updates Updates) (int64, error) ReplaceOne(filter interface{}, replacement interface{}) (int64, error) ReplaceOneByCriteria(criteria Criteria, replacement interface{}) (int64, error) FindOne(filter interface{}, doc interface{}) error FindOneByCriteria(criteria Criteria, doc interface{}) error Find(filter interface{}, docs interface{}) error FindByCriteria(criteria Criteria, docs interface{}) error Count(filter interface{}) (int64, error) CountByCriteria(criteria Criteria) (int64, error) }
Collection interface.
type Config ¶
type Config struct {
URI string
}
Config is config for database.
func (*Config) ConnString ¶
func (c *Config) ConnString() (connstring.ConnString, error)
ConnString parse string.
type Criteria ¶
type Criteria struct { PagingParam Sorts []Sort Filters []Filter }
Criteria is struct for collection.
func NewCriteria ¶
NewCriteria will parse query string into criteria format.
type Database ¶
type Database interface { Collection(name string) Collection Client() Client }
Database interface.
type PagingInfo ¶
type PagingInfo struct { PagingParam TotalRecord int64 }
PagingInfo is struct for paginating.
type PagingParam ¶
PagingParam is struct for paginating.
Click to show internal directories.
Click to hide internal directories.