Documentation
¶
Index ¶
- type SQL
- func (s *SQL) Aggregate(ctx context.Context, col string, req *model.AggregateRequest) (interface{}, error)
- func (s *SQL) Batch(ctx context.Context, req *model.BatchRequest) ([]int64, error)
- func (s *SQL) Close() error
- func (s *SQL) Create(ctx context.Context, col string, req *model.CreateRequest) (int64, error)
- func (s *SQL) CreateDatabaseIfNotExist(ctx context.Context, name string) error
- func (s *SQL) Delete(ctx context.Context, col string, req *model.DeleteRequest) (int64, error)
- func (s *SQL) DeleteCollection(ctx context.Context, col string) error
- func (s *SQL) DescribeTable(ctx context.Context, col string) ([]model.InspectorFieldType, []model.IndexType, error)
- func (s *SQL) GetCollections(ctx context.Context) ([]utils.DatabaseCollections, error)
- func (s *SQL) GetConnectionState(ctx context.Context) bool
- func (s *SQL) GetDBType() model.DBType
- func (s *SQL) IsClientSafe(ctx context.Context) error
- func (s *SQL) IsSame(conn, dbName string, driverConf config.DriverConfig) bool
- func (s *SQL) RawBatch(ctx context.Context, queries []string) error
- func (s *SQL) RawQuery(ctx context.Context, query string, isDebug bool, args []interface{}) (int64, interface{}, *model.SQLMetaData, error)
- func (s *SQL) Read(ctx context.Context, col string, req *model.ReadRequest) (int64, interface{}, map[string]map[string]string, *model.SQLMetaData, error)
- func (s *SQL) SetProjectAESKey(aesKey []byte)
- func (s *SQL) SetQueryFetchLimit(limit int64)
- func (s *SQL) Update(ctx context.Context, 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 model.DBType, enabled bool, connection string, dbName string, driverConf config.DriverConfig) (s *SQL, err error)
Init initialises a new sql instance
func (*SQL) Aggregate ¶
func (s *SQL) Aggregate(ctx context.Context, col string, req *model.AggregateRequest) (interface{}, error)
Aggregate performs a mongo db pipeline aggregation
func (*SQL) CreateDatabaseIfNotExist ¶
CreateDatabaseIfNotExist creates a schema / database
func (*SQL) DeleteCollection ¶
DeleteCollection drops a table
func (*SQL) DescribeTable ¶
func (s *SQL) DescribeTable(ctx context.Context, col string) ([]model.InspectorFieldType, []model.IndexType, error)
DescribeTable return a description of sql table & foreign keys in table NOTE: not to be exposed externally
func (*SQL) GetCollections ¶
GetCollections returns collection / tables name of specified database
func (*SQL) GetConnectionState ¶
GetConnectionState : function to check connection state
func (*SQL) IsClientSafe ¶
IsClientSafe checks whether database is enabled and connected
func (*SQL) IsSame ¶
func (s *SQL) IsSame(conn, dbName string, driverConf config.DriverConfig) bool
IsSame checks if we've got the same connection string
func (*SQL) RawBatch ¶
RawBatch performs a batch operation for schema creation NOTE: not to be exposed externally
func (*SQL) RawQuery ¶
func (s *SQL) RawQuery(ctx context.Context, query string, isDebug bool, args []interface{}) (int64, interface{}, *model.SQLMetaData, error)
RawQuery query document(s) from the database
func (*SQL) Read ¶
func (s *SQL) Read(ctx context.Context, col string, req *model.ReadRequest) (int64, interface{}, map[string]map[string]string, *model.SQLMetaData, error)
Read query document(s) from the database
func (*SQL) SetProjectAESKey ¶
SetProjectAESKey sets aes key
func (*SQL) SetQueryFetchLimit ¶
SetQueryFetchLimit sets data fetch limit