sql

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExist        = errors.New("exist")
	ErrNotExist     = errors.New("not exist")
	ErrNotSupported = errors.New("not supported")
	ErrInvalid      = errors.New("invalid")
	ErrNotEqual     = errors.New("not equal")
)

Functions

func NewAlterAddIndexSchemaWith added in v1.0.3

func NewAlterAddIndexSchemaWith(schema document.Schema, addIndex *query.Index) (document.Schema, error)

NewAlterAddColumnSchemaWith creates a new schema with the specified alter index.

func NewDocumentElementFrom added in v1.0.2

func NewDocumentElementFrom(col *query.Column) (document.Element, error)

NewDocumentElementFrom returns a new element with the specified column.

func NewDocumentElementTypeFrom added in v1.0.2

func NewDocumentElementTypeFrom(sqlType query.DataType) (document.ElementType, error)

NewDocumentElementFrom returns a new element with the specified column.

func NewDocumentIndexFrom added in v1.0.2

func NewDocumentIndexFrom(s document.Schema, def *query.Index) (document.Index, error)

NewDocumentIndexFrom creates an index from the specified coulumn definition.

func NewDocumentIndexTypeFrom added in v1.0.3

func NewDocumentIndexTypeFrom(idxType query.IndexType) (document.IndexType, error)

NewDocumentIndexTypeFrom creates an index type from the specified element.

func NewDocumentKeyForSchema added in v1.0.2

func NewDocumentKeyForSchema(dbName string, schema document.Schema, colName string, colVal any) (document.Key, error)

NewDocumentKeyForSchema returns a key for the specified schema.

func NewDocumentKeyFromCond added in v1.0.2

func NewDocumentKeyFromCond(dbName string, schema document.Schema, cond *query.Condition) (document.Key, document.IndexType, error)

NewDocumentKeyFromCond returns a key for the specified condition.

func NewDocumentKeyFromIndex added in v1.0.2

func NewDocumentKeyFromIndex(dbName string, schema document.Schema, idx document.Index, objMap document.MapObject) (document.Key, error)

NewDocumentKeyFromIndex returns a key for the specified index.

func NewDocumentKeyFromObject added in v1.0.2

func NewDocumentKeyFromObject(dbName string, schema document.Schema, obj document.MapObject) (document.Key, error)

NewDocumentKeyFromObject returns a key from the specified object.

func NewDocumentObjectFromInsert added in v1.0.2

func NewDocumentObjectFromInsert(dbName string, schema document.Schema, stmt *query.Insert) (document.Key, document.MapObject, error)

NewDocumentObjectFromInsert returns a new object from the specified schema and columns.

func NewDocumentPrimaryIndexFrom added in v1.0.2

func NewDocumentPrimaryIndexFrom(elem document.Element) (document.Index, error)

NewDocumentPrimaryIndexFrom creates an index from the specified element.

func NewDocumentSchemaFrom added in v1.0.2

func NewDocumentSchemaFrom(stmt *query.CreateTable) (document.Schema, error)

NewDocumentSchemaFrom creates a new schema from the specified schema object.

func NewLimitWith

func NewLimitWith(limit *query.Limit) []store.Option

NewLimitWith returns a new store option with the specified limit option.

func NewOrderWith

func NewOrderWith(orderBy *query.OrderBy) []store.Option

NewOrderWith returns a new store option with the specified orderby option.

func NewQueryColumnFrom added in v1.0.2

func NewQueryColumnFrom(elem document.Element) (*query.Column, error)

NewQueryColumnFrom returns a new column with the specified element.

func NewQueryDataTypeFrom added in v1.0.2

func NewQueryDataTypeFrom(elemType document.ElementType) (query.DataType, error)

NewQueryDataTypeFrom returns a new column with the specified element.

func NewQuerySchemaFrom added in v1.0.2

func NewQuerySchemaFrom(doc document.Schema) (*query.Schema, error)

NewQuerySchemaFrom creates a new schema from the specified schema object.

func NewRowFrom added in v1.0.2

func NewRowFrom(obj document.Object) (query.Row, error)

NewRowFrom creates a new row from the specified object.

Types

type Conn

type Conn interface {
	Database() string
	Timestamp() time.Time
	SpanContext() tracer.Context
}

Conn represents a SQL connection.

type Service

type Service struct {
	*plugins.BaseService
}

Service represents a new SQL service instance.

func NewService

func NewService() *Service

NewService returns a new SQL service.

func (*Service) AlterDatabase added in v1.0.3

func (service *Service) AlterDatabase(conn *postgresql.Conn, stmt *query.AlterDatabase) error

AlterDatabase handles a ALTER DATABASE query.

func (*Service) AlterTable added in v1.0.3

func (service *Service) AlterTable(conn *postgresql.Conn, stmt *query.AlterTable) error

AlterTable handles a ALTER TABLE query.

func (*Service) CancelTransactionWithError

func (service *Service) CancelTransactionWithError(ctx context.Context, txn store.Transaction, err error) error

CancelTransactionWithError cancels the specified transaction with the specified error.

func (*Service) CreateDatabase

func (service *Service) CreateDatabase(conn Conn, stmt *query.CreateDatabase) error

CreateDatabase handles a CREATE DATABASE query.

func (*Service) CreateTable

func (service *Service) CreateTable(conn Conn, stmt *query.CreateTable) error

CreateTable handles a CREATE TABLE query.

func (*Service) Delete

func (service *Service) Delete(conn Conn, stmt *query.Delete) (int, error)

Delete handles a DELETE query.

func (*Service) DeleteDocument

func (service *Service) DeleteDocument(ctx context.Context, conn Conn, txn store.Transaction, schema document.Schema, docKey document.Key) error

DeleteDocument deletes the specified object.

func (*Service) DropDatabase

func (service *Service) DropDatabase(conn Conn, stmt *query.DropDatabase) error

DropDatabase handles a DROP DATABASE query.

func (*Service) DropTable

func (service *Service) DropTable(conn Conn, stmt *query.DropTable) error

DropIndex handles a DROP INDEX query.

func (*Service) Insert

func (service *Service) Insert(conn Conn, stmt *query.Insert) error

Insert handles a INSERT query.

func (*Service) InsertSecondaryIndexes

func (service *Service) InsertSecondaryIndexes(ctx context.Context, conn Conn, txn store.Transaction, schema document.Schema, obj document.MapObject, prKey document.Key) error

InsertSecondaryIndexes inserts secondary indexes for the specified object.

func (*Service) RemoveSecondaryIndexes

func (service *Service) RemoveSecondaryIndexes(ctx context.Context, conn Conn, txn store.Transaction, schema document.Schema, obj document.MapObject) error

RemoveSecondaryIndexes removes secondary indexes for the specified object.

func (*Service) Select

Select handles a SELECT query.

func (*Service) SelectDocumentObjects

func (service *Service) SelectDocumentObjects(ctx context.Context, conn Conn, txn store.Transaction, schema document.Schema, cond *query.Condition, orderby *query.OrderBy, limit *query.Limit) (store.ResultSet, error)

SelectDatabaseObjects returns a result set of the specified database objects.

func (*Service) Update

func (service *Service) Update(conn Conn, stmt *query.Update) (int, error)

Update handles a UPDATE query.

func (*Service) UpdateDocument

func (service *Service) UpdateDocument(ctx context.Context, conn Conn, txn store.Transaction, schema document.Schema, obj any, updateCols query.ColumnList) error

UpdateDocument updates the specified object.

Jump to

Keyboard shortcuts

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