Documentation ¶
Index ¶
- type SQL
- func (s *SQL) Aggregate(ctx context.Context, project, col string, req *model.AggregateRequest) (interface{}, error)
- func (s *SQL) Batch(ctx context.Context, project string, txRequest *model.BatchRequest) ([]int64, error)
- func (s *SQL) Close() error
- func (s *SQL) Create(ctx context.Context, project, col string, req *model.CreateRequest) (int64, error)
- func (s *SQL) CreateProjectIfNotExist(ctx context.Context, project string) error
- func (s *SQL) Delete(ctx context.Context, project, col string, req *model.DeleteRequest) (int64, error)
- func (s *SQL) DeleteCollection(ctx context.Context, project, col string) error
- func (s *SQL) DescribeTable(ctx context.Context, project, col string) ([]utils.FieldType, []utils.ForeignKeysType, []utils.IndexType, error)
- func (s *SQL) GetCollections(ctx context.Context, project string) ([]utils.DatabaseCollections, error)
- func (s *SQL) GetConnectionState(ctx context.Context) bool
- func (s *SQL) GetDBType() utils.DBType
- func (s *SQL) IsClientSafe() error
- func (s *SQL) RawBatch(ctx context.Context, queries []string) error
- func (s *SQL) RawExec(ctx context.Context, query string) error
- func (s *SQL) Read(ctx context.Context, project, col string, req *model.ReadRequest) (int64, interface{}, error)
- func (s *SQL) 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 SQL ¶
type SQL struct {
// contains filtered or unexported fields
}
SQL holds the sql db object
func Init ¶
func Init(dbType utils.DBType, enabled, removeProjectScope bool, connection string) (s *SQL, err error)
Init initialises a new sql instance
func (*SQL) Aggregate ¶
func (s *SQL) Aggregate(ctx context.Context, project, col string, req *model.AggregateRequest) (interface{}, error)
Aggregate performs a mongo db pipeline aggregation
func (*SQL) Batch ¶
func (s *SQL) Batch(ctx context.Context, project string, txRequest *model.BatchRequest) ([]int64, error)
Batch performs the provided operations in a single Batch
func (*SQL) Create ¶
func (s *SQL) 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 (*SQL) CreateProjectIfNotExist ¶ added in v0.15.0
CreateProjectIfNotExist creates a schema / database
func (*SQL) Delete ¶
func (s *SQL) 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 (*SQL) DeleteCollection ¶ added in v0.13.0
DeleteCollection drops a table
func (*SQL) DescribeTable ¶ added in v0.12.0
func (s *SQL) DescribeTable(ctx context.Context, project, col string) ([]utils.FieldType, []utils.ForeignKeysType, []utils.IndexType, error)
DescribeTable return a description of sql table & foreign keys in table NOTE: not to be exposed externally
func (*SQL) GetCollections ¶ added in v0.12.0
func (s *SQL) GetCollections(ctx context.Context, project string) ([]utils.DatabaseCollections, error)
GetCollections returns collection / tables name of specified database
func (*SQL) GetConnectionState ¶ added in v0.13.0
GetConnectionState : Function to get connection state
func (*SQL) IsClientSafe ¶ added in v0.12.0
IsClientSafe checks whether database is enabled and connected
func (*SQL) RawBatch ¶ added in v0.12.0
RawBatch performs a batch operation for schema creation NOTE: not to be exposed externally
func (*SQL) RawExec ¶ added in v0.12.0
RawExec performs an operation for schema creation NOTE: not to be exposed externally