Documentation ¶
Index ¶
- Constants
- Variables
- func BuildDML(db *database, tx *transaction, dml ast.DML, params map[string]Value) (string, []interface{}, error)
- func DebugStartEnd(format string, args ...interface{}) func()
- func Debugf(format string, args ...interface{})
- func IsDebug() bool
- func QuoteString(s string) string
- func QuoteStringSlice(ss []string) []string
- type ArrayValue
- type ArrayValueDecoder
- type ArrayValueEncoder
- type BoolDecoder
- type Column
- type CustomFunction
- type Database
- type Expr
- type FakeSpannerServer
- type KeyRange
- type KeySet
- type QueryBuilder
- type ResultItem
- type RowIterator
- type StructType
- type StructValue
- type Table
- type TableIndex
- type TableView
- type TransactionStatus
- type TypeCode
- type Value
- type ValueType
Constants ¶
View Source
const ( DBDTInteger dbDataType = "INTEGER" DBDTReal dbDataType = "REAL" DBDTText dbDataType = "TEXT" DBDTBlob dbDataType = "BLOB" DBDTJson dbDataType = "JSON" )
View Source
const SqliteArgumentRuntimeErrorPrefix = "_sqlite_argument_runtime_error_: "
View Source
const SqliteOutOfRangeRuntimeErrorPrefix = "_sqlite_ooo_runtime_error_: "
Variables ¶
View Source
var ( ErrNotStartedTransaction = fmt.Errorf("transaction is not started") ErrNotAvailableTransaction = fmt.Errorf("transaction is not available") ErrInvalidatedTransaction = fmt.Errorf("transaction is invalidated") )
View Source
var NullExpr = Expr{}
View Source
var NullValue = Value{}
Functions ¶
func DebugStartEnd ¶ added in v0.4.0
func DebugStartEnd(format string, args ...interface{}) func()
func QuoteString ¶ added in v0.5.0
func QuoteStringSlice ¶ added in v0.5.0
Types ¶
type ArrayValue ¶
type ArrayValue interface {
Elements() interface{}
}
type ArrayValueDecoder ¶ added in v0.2.0
func (*ArrayValueDecoder) Scan ¶ added in v0.2.0
func (a *ArrayValueDecoder) Scan(src interface{}) error
func (*ArrayValueDecoder) UnmarshalJSON ¶ added in v0.2.0
func (a *ArrayValueDecoder) UnmarshalJSON(b []byte) error
func (*ArrayValueDecoder) Value ¶ added in v0.2.0
func (a *ArrayValueDecoder) Value() interface{}
type ArrayValueEncoder ¶ added in v0.2.0
type ArrayValueEncoder struct { Values interface{} Invalid bool }
func (*ArrayValueEncoder) Elements ¶ added in v0.2.0
func (a *ArrayValueEncoder) Elements() interface{}
type BoolDecoder ¶ added in v0.2.0
type BoolDecoder struct {
Bool *bool
}
func (*BoolDecoder) UnmarshalJSON ¶ added in v0.2.0
func (b *BoolDecoder) UnmarshalJSON(data []byte) error
type CustomFunction ¶
type Database ¶
type Database interface { ApplyDDL(ctx context.Context, ddl ast.DDL) error Read(ctx context.Context, tx *transaction, tbl, index string, cols []string, keyset *KeySet, limit int64) (RowIterator, error) Query(ctx context.Context, tx *transaction, query *ast.QueryStatement, params map[string]Value) (RowIterator, error) Execute(ctx context.Context, tx *transaction, dml ast.DML, params map[string]Value) (int64, error) Insert(ctx context.Context, tx *transaction, tbl string, cols []string, values []*structpb.ListValue) error Update(ctx context.Context, tx *transaction, tbl string, cols []string, values []*structpb.ListValue) error Replace(ctx context.Context, tx *transaction, tbl string, cols []string, values []*structpb.ListValue) error InsertOrUpdate(ctx context.Context, tx *transaction, tbl string, cols []string, values []*structpb.ListValue) error Delete(ctx context.Context, tx *transaction, table string, keyset *KeySet) error BeginTransaction(tx *transaction) error Commit(tx *transaction) error Rollback(tx *transaction) error Close() error }
type FakeSpannerServer ¶
type FakeSpannerServer interface { ApplyDDL(ctx context.Context, databaseName string, stmt ast.DDL) error spannerpb.SpannerServer adminv1pb.DatabaseAdminServer lropb.OperationsServer }
func NewFakeServer ¶
func NewFakeServer() FakeSpannerServer
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func (*QueryBuilder) Build ¶
func (b *QueryBuilder) Build() (string, []interface{}, []ResultItem, error)
func (*QueryBuilder) BuildDML ¶ added in v0.4.0
func (b *QueryBuilder) BuildDML() (string, []interface{}, error)
type ResultItem ¶
func BuildQuery ¶
type RowIterator ¶
type RowIterator interface { ResultSet() []ResultItem Do(func([]interface{}) error) error }
type StructType ¶
type StructType struct { FieldNames []string FieldTypes []*ValueType // Table can be struct but it behaves differently. // So a struct created from table should be marked. IsTable bool }
func (*StructType) AllItems ¶ added in v0.2.0
func (s *StructType) AllItems() []ResultItem
type StructValue ¶ added in v0.2.0
type StructValue struct { Keys []string `json:"keys"` Values []interface{} `json:"values"` }
type Table ¶
type Table struct { Name string // contains filtered or unexported fields }
func (*Table) NonNullableAndNonGeneratedColumnsExist ¶ added in v0.7.3
NonNullableAndNonGeneratedColumnsExist checks non nullable columns exist in the spciefied columns. It returns true and the columns if non nullable and non generated columns exist.
func (*Table) TableIndex ¶
func (t *Table) TableIndex(idx string) (*TableIndex, bool)
func (*Table) TableViewWithAlias ¶ added in v0.4.0
type TableIndex ¶
type TableIndex struct {
// contains filtered or unexported fields
}
func (*TableIndex) HasColumn ¶
func (i *TableIndex) HasColumn(c string) bool
func (*TableIndex) IndexColumnDirections ¶
func (i *TableIndex) IndexColumnDirections() []string
func (*TableIndex) IndexColumnNames ¶
func (i *TableIndex) IndexColumnNames() []string
func (*TableIndex) IndexColumns ¶
func (i *TableIndex) IndexColumns() []*Column
func (*TableIndex) Name ¶
func (i *TableIndex) Name() string
type TableView ¶
type TableView struct { ResultItems []ResultItem ResultItemsMap map[string]ResultItem // contains filtered or unexported fields }
func (*TableView) AllItems ¶
func (v *TableView) AllItems() []ResultItem
func (*TableView) ToStruct ¶ added in v0.2.0
func (v *TableView) ToStruct() *StructType
type TransactionStatus ¶ added in v0.3.0
type TransactionStatus int
const ( TransactionActive TransactionStatus = 1 TransactionInvalidated TransactionStatus = 2 TransactionCommited TransactionStatus = 3 TransactionRollbacked TransactionStatus = 4 TransactionAborted TransactionStatus = 5 )
func (TransactionStatus) String ¶ added in v0.4.0
func (s TransactionStatus) String() string
Click to show internal directories.
Click to hide internal directories.