Documentation ¶
Index ¶
- Constants
- func StringToBool(value string) bool
- func StringToInt(value string) int
- type Collection
- type Document
- func (d *Document) CheckSaved() bool
- func (d *Document) CountAll() (int64, Error)
- func (d *Document) Delete() Error
- func (d *Document) Get() *mongo.SingleResult
- func (d *Document) GetCursor(limit int64) (*mongo.Cursor, Error)
- func (d *Document) Incr(key string, value string) Error
- func (d *Document) Paginate(limit, page int64, x any) (paginate.PaginationData, Error)
- func (d *Document) PaginateWithSelect(limit, page int64) paginate.PagingQuery
- func (d *Document) Save() Error
- func (d *Document) SetCollection(c *Collection) *Document
- func (d *Document) SetData(a any) *Document
- func (d *Document) SetFields(f primitive.D) *Document
- func (d *Document) SetFilter(f primitive.D) *Document
- func (d *Document) SetUpdate(a primitive.D) *Document
- func (d *Document) Update() Error
- type Error
- type IndexFactory
- type IndexText
- type IndexType
- type IndexUnique
- type KV
- type MongoInstance
- func (mg *MongoInstance) Connect() Error
- func (mg *MongoInstance) GetCollection(value string) *mongo.Collection
- func (mg *MongoInstance) ListDatabaseNames() Error
- func (mg *MongoInstance) SetBaseUrl(value string) *MongoInstance
- func (mg *MongoInstance) SetDbName(value string) *MongoInstance
- func (mg *MongoInstance) SetUri() *MongoInstance
- type QType
- type Query
Constants ¶
View Source
const ( DEFAULT = iota + 100 //100 CONNECT //101 INDEX_CREATE //102 SAVE //103 COUNT //104 UPDATE //105 DELETE //106 GET_CURSOR //107 PAGINATE //108 )
tags
View Source
const Version = "0.0.2"
Variables ¶
This section is empty.
Functions ¶
func StringToBool ¶
func StringToInt ¶
Types ¶
type Collection ¶
type Collection struct { Name string Mg *MongoInstance Index []IndexFactory }
func NewCollection ¶
func NewCollection(name string, mg *MongoInstance) *Collection
func (*Collection) CreateIndex ¶
func (c *Collection) CreateIndex() Error
func (*Collection) GetCollection ¶
func (c *Collection) GetCollection() *mongo.Collection
func (*Collection) SetIndex ¶
func (c *Collection) SetIndex(idx []IndexFactory) *Collection
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func NewDocument ¶
func NewDocument(c *Collection) *Document
func (*Document) CheckSaved ¶
check if docs already saved in database
func (*Document) Get ¶
func (d *Document) Get() *mongo.SingleResult
func (*Document) PaginateWithSelect ¶
func (d *Document) PaginateWithSelect(limit, page int64) paginate.PagingQuery
func (*Document) SetCollection ¶
func (d *Document) SetCollection(c *Collection) *Document
type IndexFactory ¶
func (*IndexFactory) CreateIndex ¶
func (x *IndexFactory) CreateIndex(c *Collection) Error
type IndexUnique ¶
type IndexUnique struct {
// contains filtered or unexported fields
}
func (*IndexUnique) Set ¶
func (x *IndexUnique) Set()
type MongoInstance ¶
type MongoInstance struct { DbName string BaseUrl string Uri string Context context.Context Client *mongo.Client Db *mongo.Database Connected bool }
MongoInstance contains the Mongo client and database objects
func NewMongoInstance ¶
func NewMongoInstance(dbName, baseUrl string) *MongoInstance
func (*MongoInstance) Connect ¶
func (mg *MongoInstance) Connect() Error
func (*MongoInstance) GetCollection ¶
func (mg *MongoInstance) GetCollection(value string) *mongo.Collection
func (*MongoInstance) ListDatabaseNames ¶
func (mg *MongoInstance) ListDatabaseNames() Error
func (*MongoInstance) SetBaseUrl ¶
func (mg *MongoInstance) SetBaseUrl(value string) *MongoInstance
func (*MongoInstance) SetDbName ¶
func (mg *MongoInstance) SetDbName(value string) *MongoInstance
func (*MongoInstance) SetUri ¶
func (mg *MongoInstance) SetUri() *MongoInstance
Click to show internal directories.
Click to hide internal directories.