Documentation ¶
Index ¶
- type Mongo
- func (m *Mongo) Aggregate(ctx context.Context, project, col string, req *model.AggregateRequest) (interface{}, error)
- func (m *Mongo) Batch(ctx context.Context, project string, txRequest *model.BatchRequest) ([]int64, error)
- func (m *Mongo) Close() error
- func (m *Mongo) Create(ctx context.Context, project, col string, req *model.CreateRequest) (int64, error)
- func (s *Mongo) CreateProjectIfNotExist(ctx context.Context, project string) error
- func (m *Mongo) Delete(ctx context.Context, project, col string, req *model.DeleteRequest) (int64, error)
- func (m Mongo) DeleteCollection(ctx context.Context, project, col string) error
- func (m *Mongo) DescribeTable(ctx context.Context, project, col string) ([]utils.FieldType, []utils.ForeignKeysType, []utils.IndexType, error)
- func (m *Mongo) GetCollections(ctx context.Context, project string) ([]utils.DatabaseCollections, error)
- func (m *Mongo) GetConnectionState(ctx context.Context) bool
- func (m *Mongo) GetDBType() utils.DBType
- func (m *Mongo) IsClientSafe() error
- func (m *Mongo) RawBatch(ctx context.Context, queries []string) error
- func (m *Mongo) RawExec(ctx context.Context, query string) error
- func (m *Mongo) Read(ctx context.Context, project, col string, req *model.ReadRequest) (int64, interface{}, error)
- func (m *Mongo) Update(ctx context.Context, project, col string, req *model.UpdateRequest) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
Mongo holds the mongo session
func (*Mongo) Aggregate ¶
func (m *Mongo) Aggregate(ctx context.Context, project, col string, req *model.AggregateRequest) (interface{}, error)
Aggregate performs a mongo db pipeline aggregation
func (*Mongo) Batch ¶
func (m *Mongo) Batch(ctx context.Context, project string, txRequest *model.BatchRequest) ([]int64, error)
Batch performs the provided operations in a single Batch
func (*Mongo) Create ¶
func (m *Mongo) Create(ctx context.Context, project, col string, req *model.CreateRequest) (int64, error)
Create inserts a document (or multiple when op is "all") into the database
func (*Mongo) CreateProjectIfNotExist ¶ added in v0.15.0
func (*Mongo) Delete ¶
func (m *Mongo) Delete(ctx context.Context, project, col string, req *model.DeleteRequest) (int64, error)
Delete removes the document(s) from the database which match the condition
func (Mongo) DeleteCollection ¶ added in v0.13.0
DeleteCollection removes a collection from database`
func (*Mongo) DescribeTable ¶ added in v0.12.0
func (m *Mongo) DescribeTable(ctx context.Context, project, col string) ([]utils.FieldType, []utils.ForeignKeysType, []utils.IndexType, error)
DescribeTable return a structure of sql table
func (*Mongo) GetCollections ¶ added in v0.12.0
func (m *Mongo) GetCollections(ctx context.Context, project string) ([]utils.DatabaseCollections, error)
GetCollections returns collection / tables name of specified database
func (*Mongo) GetConnectionState ¶ added in v0.13.0
GetConnectionState : function to check connection state
func (*Mongo) IsClientSafe ¶ added in v0.12.0
IsClientSafe checks whether database is enabled and connected
func (*Mongo) RawBatch ¶ added in v0.12.0
RawBatch performs a batch operation for schema creation NOTE: not to be exposed externally
func (*Mongo) RawExec ¶ added in v0.12.0
RawExec performs an operation for schema creation NOTE: not to be exposed externally