sql

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

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, connection string) (*SQL, 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) error

Batch performs the provided operations in a single Batch

func (*SQL) Close

func (s *SQL) Close() error

Close gracefully the SQL client

func (*SQL) Create

func (s *SQL) Create(ctx context.Context, project, col string, req *model.CreateRequest) error

Create inserts a document (or multiple when op is "all") into the database

func (*SQL) Delete

func (s *SQL) Delete(ctx context.Context, project, col string, req *model.DeleteRequest) error

Delete removes the document(s) from the database which match the condition

func (*SQL) GetDBType

func (s *SQL) GetDBType() utils.DBType

GetDBType returns the dbType of the crud block

func (*SQL) Read

func (s *SQL) Read(ctx context.Context, project, col string, req *model.ReadRequest) (interface{}, error)

Read query document(s) from the database

func (*SQL) Update

func (s *SQL) Update(ctx context.Context, project, col string, req *model.UpdateRequest) error

Update updates the document(s) which match the condition provided.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL