Documentation ¶
Index ¶
- type Crud
- type Module
- func (m *Module) Aggregate(ctx context.Context, dbType, project, col string, req *model.AggregateRequest) (interface{}, error)
- func (m *Module) Batch(ctx context.Context, dbType, project string, req *model.BatchRequest) error
- func (m *Module) Create(ctx context.Context, dbType, project, col string, req *model.CreateRequest) error
- func (m *Module) CreateProjectIfNotExists(ctx context.Context, project, dbType string) error
- func (m *Module) Delete(ctx context.Context, dbType, project, col string, req *model.DeleteRequest) error
- func (m *Module) DescribeTable(ctx context.Context, dbType, project, col string) ([]utils.FieldType, []utils.ForeignKeysType, error)
- func (m *Module) GetCollections(ctx context.Context, project, dbType string) ([]utils.DatabaseCollections, error)
- func (m *Module) InternalCreate(ctx context.Context, dbType, project, col string, req *model.CreateRequest) error
- func (m *Module) InternalDelete(ctx context.Context, dbType, project, col string, req *model.DeleteRequest) error
- func (m *Module) InternalUpdate(ctx context.Context, dbType, project, col string, req *model.UpdateRequest) error
- func (m *Module) RawBatch(ctx context.Context, dbType string, batchedQueries []string) error
- func (m *Module) Read(ctx context.Context, dbType, project, col string, req *model.ReadRequest) (interface{}, error)
- func (m *Module) SetConfig(crud config.Crud) error
- func (m *Module) SetHooks(hooks *model.CrudHooks)
- func (m *Module) Update(ctx context.Context, dbType, project, col string, req *model.UpdateRequest) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Crud ¶
type Crud interface { Create(ctx context.Context, project, col string, req *model.CreateRequest) error Read(ctx context.Context, project, col string, req *model.ReadRequest) (interface{}, error) Update(ctx context.Context, project, col string, req *model.UpdateRequest) error Delete(ctx context.Context, project, col string, req *model.DeleteRequest) error Aggregate(ctx context.Context, project, col string, req *model.AggregateRequest) (interface{}, error) Batch(ctx context.Context, project string, req *model.BatchRequest) error DescribeTable(ctc context.Context, project, dbType, col string) ([]utils.FieldType, []utils.ForeignKeysType, error) RawExec(ctx context.Context, project string) error GetCollections(ctx context.Context, project string) ([]utils.DatabaseCollections, error) RawBatch(ctx context.Context, batchedQueries []string) error GetDBType() utils.DBType IsClientSafe() error Close() error }
Crud abstracts the implementation crud operations of databases
type Module ¶
Module is the root block providing convenient wrappers
func (*Module) Aggregate ¶
func (m *Module) Aggregate(ctx context.Context, dbType, project, col string, req *model.AggregateRequest) (interface{}, error)
Aggregate performs an aggregation defined via the pipeline
func (*Module) Create ¶
func (m *Module) Create(ctx context.Context, dbType, project, col string, req *model.CreateRequest) error
Create inserts a document (or multiple when op is "all") into the database based on dbType
func (*Module) CreateProjectIfNotExists ¶ added in v0.12.0
GetCollections returns collection / tables name of specified database
func (*Module) Delete ¶
func (m *Module) Delete(ctx context.Context, dbType, project, col string, req *model.DeleteRequest) error
Delete removes the document(s) which match a query from the database based on dbType
func (*Module) DescribeTable ¶ added in v0.12.0
func (m *Module) DescribeTable(ctx context.Context, dbType, project, col string) ([]utils.FieldType, []utils.ForeignKeysType, error)
DescribeTable performs a db operation for describing a table
func (*Module) GetCollections ¶ added in v0.12.0
func (m *Module) GetCollections(ctx context.Context, project, dbType string) ([]utils.DatabaseCollections, error)
GetCollections returns collection / tables name of specified database
func (*Module) InternalCreate ¶ added in v0.12.0
func (m *Module) InternalCreate(ctx context.Context, dbType, project, col string, req *model.CreateRequest) error
InternalCreate inserts a document (or multiple when op is "all") into the database based on dbType. It does not invoke any hooks. This should only be used by the eventing module.
func (*Module) InternalDelete ¶ added in v0.12.0
func (m *Module) InternalDelete(ctx context.Context, dbType, project, col string, req *model.DeleteRequest) error
InternalDelete removes the document(s) which match a query from the database based on dbType. It does not invoke any hooks. This should only be used by the eventing module.
func (*Module) InternalUpdate ¶ added in v0.12.0
func (m *Module) InternalUpdate(ctx context.Context, dbType, project, col string, req *model.UpdateRequest) error
InternalUpdate updates the document(s) which match a query from the database based on dbType. It does not invoke any hooks. This should only be used by the eventing module.
func (*Module) Read ¶
func (m *Module) Read(ctx context.Context, dbType, project, col string, req *model.ReadRequest) (interface{}, error)
Read returns the document(s) which match a query from the database based on dbType