Documentation ¶
Index ¶
- type Crud
- type Module
- func (m *Module) Aggregate(ctx context.Context, dbAlias, col string, req *model.AggregateRequest, ...) (interface{}, error)
- func (m *Module) Batch(ctx context.Context, dbAlias string, req *model.BatchRequest, ...) error
- func (m *Module) CloseConfig() error
- func (m *Module) Create(ctx context.Context, dbAlias, col string, req *model.CreateRequest, ...) error
- func (m *Module) Delete(ctx context.Context, dbAlias, col string, req *model.DeleteRequest, ...) error
- func (m *Module) DeleteTable(ctx context.Context, dbAlias, col string) error
- func (m *Module) DescribeTable(ctx context.Context, dbAlias, col string) ([]model.InspectorFieldType, []model.IndexType, error)
- func (m *Module) ExecPreparedQuery(ctx context.Context, dbAlias, id string, req *model.PreparedQueryRequest, ...) (interface{}, *model.SQLMetaData, error)
- func (m *Module) GetCollections(ctx context.Context, dbAlias string) ([]utils.DatabaseCollections, error)
- func (m *Module) GetConnectionState(ctx context.Context, dbAlias string) bool
- func (m *Module) GetDBType(dbAlias string) (string, error)
- func (m *Module) GetSchema(dbAlias, col string) (model.Fields, bool)
- func (m *Module) InternalCreate(ctx context.Context, dbAlias, project, col string, req *model.CreateRequest, ...) error
- func (m *Module) InternalDelete(ctx context.Context, dbAlias, project, col string, req *model.DeleteRequest) error
- func (m *Module) InternalUpdate(ctx context.Context, dbAlias, project, col string, req *model.UpdateRequest) error
- func (m *Module) IsPreparedQueryPresent(dbAlias, id string) bool
- func (m *Module) RawBatch(ctx context.Context, dbAlias string, batchedQueries []string) error
- func (m *Module) Read(ctx context.Context, dbAlias, col string, req *model.ReadRequest, ...) (interface{}, *model.SQLMetaData, error)
- func (m *Module) SetAdminManager(a *admin.Manager)
- func (m *Module) SetCachingModule(c cachingInterface)
- func (m *Module) SetConfig(project string, crud config.DatabaseConfigs) error
- func (m *Module) SetGetSecrets(function utils.GetSecrets)
- func (m *Module) SetHooks(metricHook model.MetricCrudHook)
- func (m *Module) SetIntegrationManager(i integrationManagerInterface)
- func (m *Module) SetPreparedQueryConfig(ctx context.Context, prepQueries config.DatabasePreparedQueries) error
- func (m *Module) SetProjectAESKey(aesKey string) error
- func (m *Module) SetSchemaConfig(ctx context.Context, schemaDoc model.Type, schemas config.DatabaseSchemas) error
- func (m *Module) Update(ctx context.Context, dbAlias, 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, col string, req *model.CreateRequest) (int64, error) Read(ctx context.Context, col string, req *model.ReadRequest) (int64, interface{}, map[string]map[string]string, *model.SQLMetaData, error) Update(ctx context.Context, col string, req *model.UpdateRequest) (int64, error) Delete(ctx context.Context, col string, req *model.DeleteRequest) (int64, error) Aggregate(ctx context.Context, col string, req *model.AggregateRequest) (interface{}, error) Batch(ctx context.Context, req *model.BatchRequest) ([]int64, error) DescribeTable(ctc context.Context, col string) ([]model.InspectorFieldType, []model.IndexType, error) RawQuery(ctx context.Context, query string, isDebug bool, args []interface{}) (int64, interface{}, *model.SQLMetaData, error) GetCollections(ctx context.Context) ([]utils.DatabaseCollections, error) DeleteCollection(ctx context.Context, col string) error CreateDatabaseIfNotExist(ctx context.Context, name string) error RawBatch(ctx context.Context, batchedQueries []string) error GetDBType() model.DBType IsClientSafe(ctx context.Context) error IsSame(conn, dbName string, driverConf config.DriverConfig) bool Close() error GetConnectionState(ctx context.Context) bool SetQueryFetchLimit(limit int64) SetProjectAESKey(aesKey []byte) }
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, dbAlias, col string, req *model.AggregateRequest, params model.RequestParams) (interface{}, error)
Aggregate performs an aggregation defined via the pipeline
func (*Module) Batch ¶
func (m *Module) Batch(ctx context.Context, dbAlias string, req *model.BatchRequest, params model.RequestParams) error
Batch performs a batch operation on the database
func (*Module) CloseConfig ¶
CloseConfig close the rules and secret key required by the crud block
func (*Module) Create ¶
func (m *Module) Create(ctx context.Context, dbAlias, col string, req *model.CreateRequest, params model.RequestParams) error
Create inserts a documents (or multiple when op is "all") into the database based on dbType
func (*Module) Delete ¶
func (m *Module) Delete(ctx context.Context, dbAlias, col string, req *model.DeleteRequest, params model.RequestParams) error
Delete removes the documents(s) which match a query from the database based on dbType
func (*Module) DeleteTable ¶
DeleteTable drop specified table from database
func (*Module) DescribeTable ¶
func (m *Module) DescribeTable(ctx context.Context, dbAlias, col string) ([]model.InspectorFieldType, []model.IndexType, error)
DescribeTable performs a db operation for describing a table
func (*Module) ExecPreparedQuery ¶
func (m *Module) ExecPreparedQuery(ctx context.Context, dbAlias, id string, req *model.PreparedQueryRequest, params model.RequestParams) (interface{}, *model.SQLMetaData, error)
ExecPreparedQuery executes PreparedQueries request
func (*Module) GetCollections ¶
func (m *Module) GetCollections(ctx context.Context, dbAlias string) ([]utils.DatabaseCollections, error)
GetCollections returns collection / tables name of specified database
func (*Module) GetConnectionState ¶
GetConnectionState gets the current state of client
func (*Module) InternalCreate ¶
func (m *Module) InternalCreate(ctx context.Context, dbAlias, project, col string, req *model.CreateRequest, isIgnoreMetrics bool) error
InternalCreate inserts a documents (or multiple when op is "all") into the database based on dbAlias. It does not invoke any hooks. This should only be used by the eventing module.
func (*Module) InternalDelete ¶
func (m *Module) InternalDelete(ctx context.Context, dbAlias, project, col string, req *model.DeleteRequest) error
InternalDelete removes the documents(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 ¶
func (m *Module) InternalUpdate(ctx context.Context, dbAlias, project, col string, req *model.UpdateRequest) error
InternalUpdate updates the documents(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) IsPreparedQueryPresent ¶
IsPreparedQueryPresent checks if id exist
func (*Module) Read ¶
func (m *Module) Read(ctx context.Context, dbAlias, col string, req *model.ReadRequest, params model.RequestParams) (interface{}, *model.SQLMetaData, error)
Read returns the documents(s) which match a query from the database based on dbType
func (*Module) SetAdminManager ¶
SetAdminManager sets the admin manager
func (*Module) SetCachingModule ¶
func (m *Module) SetCachingModule(c cachingInterface)
SetCachingModule sets caching module
func (*Module) SetConfig ¶
func (m *Module) SetConfig(project string, crud config.DatabaseConfigs) error
SetConfig set the rules and secret key required by the crud block
func (*Module) SetGetSecrets ¶
func (m *Module) SetGetSecrets(function utils.GetSecrets)
SetGetSecrets sets the GetSecrets function
func (*Module) SetHooks ¶
func (m *Module) SetHooks(metricHook model.MetricCrudHook)
SetHooks sets the internal hooks
func (*Module) SetIntegrationManager ¶
func (m *Module) SetIntegrationManager(i integrationManagerInterface)
SetIntegrationManager sets the integration manager
func (*Module) SetPreparedQueryConfig ¶
func (m *Module) SetPreparedQueryConfig(ctx context.Context, prepQueries config.DatabasePreparedQueries) error
SetPreparedQueryConfig set prepared query config of crud module
func (*Module) SetProjectAESKey ¶
SetProjectAESKey set aes config for sql databases
func (*Module) SetSchemaConfig ¶
func (m *Module) SetSchemaConfig(ctx context.Context, schemaDoc model.Type, schemas config.DatabaseSchemas) error
SetSchemaConfig set schema config of crud module