Documentation ¶
Overview ¶
Package godynamo provides database/sql driver for AWS DynamoDB.
Index ¶
- Constants
- Variables
- func DeregisterAWSConfig()
- func IsAwsError(err error, awsErrCode string) bool
- func RegisterAWSConfig(conf aws.Config)
- func ToAttributeValue(value interface{}) (types.AttributeValue, error)
- func ToAttributeValueUnsafe(value interface{}) types.AttributeValue
- func TransformInsertStmToPartiQL(insStm string) (string, error)
- func ValuesToNamedValues(values []driver.Value) []driver.NamedValue
- func WaitForGSIStatus(ctx context.Context, db *sql.DB, tableName, gsiName string, ...) error
- func WaitForTableStatus(ctx context.Context, db *sql.DB, tableName string, statusList []string, ...) error
- type Conn
- func (c *Conn) Begin() (driver.Tx, error)
- func (c *Conn) BeginTx(_ context.Context, _ driver.TxOptions) (driver.Tx, error)
- func (c *Conn) CheckNamedValue(_ *driver.NamedValue) error
- func (c *Conn) Close() error
- func (c *Conn) Prepare(query string) (driver.Stmt, error)
- func (c *Conn) PrepareContext(_ context.Context, query string) (driver.Stmt, error)
- type Driver
- type OptStrings
- type ResultNoResultSet
- type ResultResultSet
- type RowsDescribeIndex
- type RowsDescribeTable
- type RowsListTables
- type Stmt
- type StmtAlterGSI
- func (s *StmtAlterGSI) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtAlterGSI) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtAlterGSI) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtAlterGSI) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtAlterTable
- func (s *StmtAlterTable) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtAlterTable) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtAlterTable) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtAlterTable) QueryContext(_ []driver.NamedValue) (driver.Rows, error)
- type StmtCreateGSI
- func (s *StmtCreateGSI) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtCreateGSI) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtCreateGSI) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtCreateGSI) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtCreateTable
- func (s *StmtCreateTable) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtCreateTable) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtCreateTable) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtCreateTable) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtDelete
- func (s *StmtDelete) Exec(values []driver.Value) (driver.Result, error)
- func (s *StmtDelete) ExecContext(ctx context.Context, values []driver.NamedValue) (driver.Result, error)
- func (s *StmtDelete) Query(values []driver.Value) (driver.Rows, error)
- func (s *StmtDelete) QueryContext(ctx context.Context, values []driver.NamedValue) (driver.Rows, error)
- type StmtDescribeGSI
- func (s *StmtDescribeGSI) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtDescribeGSI) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtDescribeGSI) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtDescribeGSI) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtDescribeLSI
- func (s *StmtDescribeLSI) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtDescribeLSI) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtDescribeLSI) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtDescribeLSI) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtDescribeTable
- func (s *StmtDescribeTable) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtDescribeTable) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtDescribeTable) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtDescribeTable) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtDropGSI
- func (s *StmtDropGSI) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtDropGSI) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtDropGSI) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtDropGSI) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtDropTable
- func (s *StmtDropTable) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtDropTable) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtDropTable) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtDropTable) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtExecutable
- type StmtInsert
- func (s *StmtInsert) Exec(values []driver.Value) (driver.Result, error)
- func (s *StmtInsert) ExecContext(ctx context.Context, values []driver.NamedValue) (driver.Result, error)
- func (s *StmtInsert) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtInsert) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtListTables
- func (s *StmtListTables) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtListTables) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtListTables) Query(_ []driver.Value) (driver.Rows, error)
- func (s *StmtListTables) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
- type StmtSelect
- func (s *StmtSelect) Exec(_ []driver.Value) (driver.Result, error)
- func (s *StmtSelect) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
- func (s *StmtSelect) Query(values []driver.Value) (driver.Rows, error)
- func (s *StmtSelect) QueryContext(ctx context.Context, values []driver.NamedValue) (driver.Rows, error)
- type StmtUpdate
- func (s *StmtUpdate) Exec(values []driver.Value) (driver.Result, error)
- func (s *StmtUpdate) ExecContext(ctx context.Context, values []driver.NamedValue) (driver.Result, error)
- func (s *StmtUpdate) Query(values []driver.Value) (driver.Rows, error)
- func (s *StmtUpdate) QueryContext(ctx context.Context, values []driver.NamedValue) (driver.Rows, error)
- type Tx
- type TxResultNoResultSet
Constants ¶
const (
// Version holds the semantic version number of this module.
Version = "1.3.0"
)
Variables ¶
var ( ErrInTx = errors.New("there is an ongoing transaction, new transaction/statement or fetching result is not allowed") ErrInvalidTxStage = errors.New("invalid transaction stage") ErrNoTx = errors.New("no transaction is in progress") ErrTxCommitting = errors.New("transaction is being committed") ErrTxRollingBack = errors.New("transaction is being rolled back") )
var ( TableColumnDesiredTypesMapKey = "go_dynamo_table_column_desired_types_map" TableNameKey = "go_dynamo_table_name" )
var ( ErrNotValidInsertStm = errors.New("input is not an invalid INSERT statement") ErrFieldsAndValuesNotMatch = errors.New("number of fields and values mismatch") )
Functions ¶
func DeregisterAWSConfig ¶
func DeregisterAWSConfig()
DeregisterAWSConfig removes the registered aws.Config.
@Available since v1.3.0
func IsAwsError ¶
IsAwsError returns true if err is an AWS-specific error, and it matches awsErrCode.
func RegisterAWSConfig ¶
RegisterAWSConfig registers aws.Config to be used by the dynamodb client.
The following configurations do not apply even if they are set in aws.Config.
- HTTPClient
@Available since v1.3.0
func ToAttributeValue ¶
func ToAttributeValue(value interface{}) (types.AttributeValue, error)
ToAttributeValue marshals a Go value to AWS AttributeValue.
func ToAttributeValueUnsafe ¶
func ToAttributeValueUnsafe(value interface{}) types.AttributeValue
ToAttributeValueUnsafe marshals a Go value to AWS AttributeValue, ignoring error.
@Available since v0.2.0
func TransformInsertStmToPartiQL ¶
TransformInsertStmToPartiQL converts an INSERT statement to a PartiQL statement.
e.g. INSERT INTO table_name (field1, field2, field3) VALUES ('val1', ?, 3) will be converted to INSERT INTO table_name VALUE {'field1': 'val1', 'field2': ?, 'field3': 3}
Note:
- table name is automatically double-quoted per PartiQL syntax.
- field name is automatically single-quoted per PartiQL syntax.
- value is automatically single-quoted if it is a string per PartiQL syntax.
- Order of fields after conversion is the same as the order of fields in the original INSERT statement.
- Other than the above, the value is kept as-is! It is the caller's responsibility to ensure the value is valid.
- PartiQL syntax for INSERT statement: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.insert.html
@Available since v1.1.0
func ValuesToNamedValues ¶
func ValuesToNamedValues(values []driver.Value) []driver.NamedValue
ValuesToNamedValues transforms a []driver.Value to []driver.NamedValue.
@Available since v0.2.0
func WaitForGSIStatus ¶
func WaitForGSIStatus(ctx context.Context, db *sql.DB, tableName, gsiName string, statusList []string, sleepTime time.Duration) error
WaitForGSIStatus periodically checks if table's GSI status reaches a desired value, or timeout.
- statusList: list of desired statuses. This function returns nil if one of the desired statuses is reached.
- delay: sleep for this amount of time after each status check. Supplied value of 0 or negative means 'no sleep'.
- timeout is controlled via ctx.
- Note: this function treats GSI status as "" if it does not exist. Thus, supply value "" to statusList to wait for GSI to be deleted.
@Available since v1.1.0
func WaitForTableStatus ¶
func WaitForTableStatus(ctx context.Context, db *sql.DB, tableName string, statusList []string, sleepTime time.Duration) error
WaitForTableStatus periodically checks if table status reaches a desired value, or timeout.
- statusList: list of desired statuses. This function returns nil if one of the desired statuses is reached.
- delay: sleep for this amount of time after each status check. Supplied value of 0 or negative means 'no sleep'.
- timeout is controlled via ctx.
- Note: this function treats table status as "" if it does not exist. Thus, supply value "" to statusList to wait for table to be deleted.
@Available since v1.1.0
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is AWS DynamoDB implementation of driver.Conn.
func (*Conn) CheckNamedValue ¶
func (c *Conn) CheckNamedValue(_ *driver.NamedValue) error
CheckNamedValue implements driver.NamedValueChecker/CheckNamedValue.
type Driver ¶
type Driver struct { }
Driver is AWS DynamoDB implementation of driver.Driver.
type OptStrings ¶
type OptStrings []string
func (OptStrings) BoolAt ¶
func (s OptStrings) BoolAt(i int) bool
func (OptStrings) FirstBool ¶
func (s OptStrings) FirstBool() bool
func (OptStrings) FirstString ¶
func (s OptStrings) FirstString() string
func (OptStrings) StringAt ¶
func (s OptStrings) StringAt(i int) string
type ResultNoResultSet ¶
type ResultNoResultSet struct {
// contains filtered or unexported fields
}
ResultNoResultSet captures the result from statements that do not expect a ResultSet to be returned.
func (*ResultNoResultSet) LastInsertId ¶
func (r *ResultNoResultSet) LastInsertId() (int64, error)
LastInsertId implements driver.Result/LastInsertId.
func (*ResultNoResultSet) RowsAffected ¶
func (r *ResultNoResultSet) RowsAffected() (int64, error)
RowsAffected implements driver.Result/RowsAffected.
type ResultResultSet ¶
type ResultResultSet struct {
// contains filtered or unexported fields
}
ResultResultSet captures the result from statements that expect a ResultSet to be returned.
func (*ResultResultSet) Close ¶
func (r *ResultResultSet) Close() error
Close implements driver.Rows/Close.
func (*ResultResultSet) ColumnTypeDatabaseTypeName ¶
func (r *ResultResultSet) ColumnTypeDatabaseTypeName(index int) string
ColumnTypeDatabaseTypeName implements driver.RowsColumnTypeDatabaseTypeName/ColumnTypeDatabaseTypeName
@since v0.3.0 ColumnTypeDatabaseTypeName returns DynamoDB's native data types (e.g. B, N, S, SS, NS, BS, BOOL, L, M, NULL).
func (*ResultResultSet) ColumnTypeScanType ¶
func (r *ResultResultSet) ColumnTypeScanType(index int) reflect.Type
ColumnTypeScanType implements driver.RowsColumnTypeScanType/ColumnTypeScanType
func (*ResultResultSet) Columns ¶
func (r *ResultResultSet) Columns() []string
Columns implements driver.Rows/Columns.
type RowsDescribeIndex ¶
type RowsDescribeIndex struct {
// contains filtered or unexported fields
}
RowsDescribeIndex captures the result from DESCRIBE LSI or DESCRIBE GSI statement.
func (*RowsDescribeIndex) Close ¶
func (r *RowsDescribeIndex) Close() error
Close implements driver.Rows/Close.
func (*RowsDescribeIndex) ColumnTypeDatabaseTypeName ¶
func (r *RowsDescribeIndex) ColumnTypeDatabaseTypeName(index int) string
ColumnTypeDatabaseTypeName implements driver.RowsColumnTypeDatabaseTypeName/ColumnTypeDatabaseTypeName
@since v0.3.0 ColumnTypeDatabaseTypeName returns DynamoDB's native data types (e.g. B, N, S, SS, NS, BS, BOOL, L, M, NULL).
func (*RowsDescribeIndex) ColumnTypeScanType ¶
func (r *RowsDescribeIndex) ColumnTypeScanType(index int) reflect.Type
ColumnTypeScanType implements driver.RowsColumnTypeScanType/ColumnTypeScanType
func (*RowsDescribeIndex) Columns ¶
func (r *RowsDescribeIndex) Columns() []string
Columns implements driver.Rows/Columns.
type RowsDescribeTable ¶
type RowsDescribeTable struct {
// contains filtered or unexported fields
}
RowsDescribeTable captures the result from DESCRIBE TABLE statement.
func (*RowsDescribeTable) Close ¶
func (r *RowsDescribeTable) Close() error
Close implements driver.Rows/Close.
func (*RowsDescribeTable) ColumnTypeDatabaseTypeName ¶
func (r *RowsDescribeTable) ColumnTypeDatabaseTypeName(index int) string
ColumnTypeDatabaseTypeName implements driver.RowsColumnTypeDatabaseTypeName/ColumnTypeDatabaseTypeName
@since v0.3.0 ColumnTypeDatabaseTypeName returns DynamoDB's native data types (e.g. B, N, S, SS, NS, BS, BOOL, L, M, NULL).
func (*RowsDescribeTable) ColumnTypeScanType ¶
func (r *RowsDescribeTable) ColumnTypeScanType(index int) reflect.Type
ColumnTypeScanType implements driver.RowsColumnTypeScanType/ColumnTypeScanType
func (*RowsDescribeTable) Columns ¶
func (r *RowsDescribeTable) Columns() []string
Columns implements driver.Rows/Columns.
type RowsListTables ¶
type RowsListTables struct {
// contains filtered or unexported fields
}
RowsListTables captures the result from LIST TABLES statement.
func (*RowsListTables) Close ¶
func (r *RowsListTables) Close() error
Close implements driver.Rows/Close.
func (*RowsListTables) ColumnTypeDatabaseTypeName ¶
func (r *RowsListTables) ColumnTypeDatabaseTypeName(_ int) string
ColumnTypeDatabaseTypeName implements driver.RowsColumnTypeDatabaseTypeName/ColumnTypeDatabaseTypeName
func (*RowsListTables) ColumnTypeScanType ¶
func (r *RowsListTables) ColumnTypeScanType(_ int) reflect.Type
ColumnTypeScanType implements driver.RowsColumnTypeScanType/ColumnTypeScanType
func (*RowsListTables) Columns ¶
func (r *RowsListTables) Columns() []string
Columns implements driver.Rows/Columns.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt is AWS DynamoDB abstract implementation of driver.Stmt.
type StmtAlterGSI ¶
type StmtAlterGSI struct { *Stmt // contains filtered or unexported fields }
StmtAlterGSI implements "ALTER GSI" statement.
Syntax:
ALTER GSI <index-name> ON <table-name> WITH wcu=<number>[,] WITH rcu=<number> - RCU: an integer specifying DynamoDB's read capacity. - WCU: an integer specifying DynamoDB's write capacity. - Note: The provisioned throughput settings of a GSI are separate from those of its base table. - Note: GSI inherit the RCU and WCU mode from the base table. That means if the base table is in on-demand mode, then DynamoDB also creates the GSI in on-demand mode. - Note: there must be at least one space before the WITH keyword.
func (*StmtAlterGSI) ExecContext ¶
func (s *StmtAlterGSI) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtAlterGSI) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtAlterGSI) QueryContext ¶
func (s *StmtAlterGSI) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtAlterTable ¶
type StmtAlterTable struct { *Stmt // contains filtered or unexported fields }
StmtAlterTable implements "ALTER TABLE" statement.
Syntax:
ALTER TABLE <table-name> [WITH RCU=rcu[,] WITH WCU=wcu] [[,] WITH CLASS=<table-class>] - RCU: an integer specifying DynamoDB's read capacity. - WCU: an integer specifying DynamoDB's write capacity. - CLASS: table class, either STANDARD (default) or STANDARD_IA. - Note: if RCU and WRU are both 0, table's billing mode will be updated to PAY_PER_REQUEST; otherwise billing mode will be updated to PROVISIONED. - Note: there must be at least one space before the WITH keyword.
func (*StmtAlterTable) ExecContext ¶
func (s *StmtAlterTable) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtAlterTable) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtAlterTable) QueryContext ¶
func (s *StmtAlterTable) QueryContext(_ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtCreateGSI ¶
type StmtCreateGSI struct { *Stmt // contains filtered or unexported fields }
StmtCreateGSI implements "CREATE GSI" statement.
Syntax:
CREATE GSI [IF NOT EXISTS] <index-name> ON <table-name> <WITH PK=pk-attr-name:data-type> [[,] WITH SK=sk-attr-name:data-type] [[,] WITH wcu=<number>[,] WITH rcu=<number>] [[,] WITH projection=*|attr1,attr2,attr3,...] - PK: GSI's partition key, format name:type (type is one of String, Number, Binary). - SK: GSI's sort key, format name:type (type is one of String, Number, Binary). - RCU: an integer specifying DynamoDB's read capacity. - WCU: an integer specifying DynamoDB's write capacity. - PROJECTION: - if not supplied, GSI will be created with projection setting KEYS_ONLY. - if equal to "*", GSI will be created with projection setting ALL. - if supplied with comma-separated attribute list, for example "attr1,attr2,attr3", GSI will be created with projection setting INCLUDE. - If "IF NOT EXISTS" is specified, Exec will silently swallow the error "Attempting to create an index which already exists". - Note: The provisioned throughput settings of a GSI are separate from those of its base table. - Note: GSI inherit the RCU and WCU mode from the base table. That means if the base table is in on-demand mode, then DynamoDB also creates the GSI in on-demand mode. - Note: there must be at least one space before the WITH keyword.
func (*StmtCreateGSI) ExecContext ¶
func (s *StmtCreateGSI) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtCreateGSI) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtCreateGSI) QueryContext ¶
func (s *StmtCreateGSI) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtCreateTable ¶
type StmtCreateTable struct { *Stmt // contains filtered or unexported fields }
StmtCreateTable implements "CREATE TABLE" statement.
Syntax:
CREATE TABLE [IF NOT EXISTS] <table-name> <WITH PK=pk-attr-name:data-type> [[,] WITH SK=sk-attr-name:data-type] [[,] WITH wcu=<number>[,] WITH rcu=<number>] [[,] WITH LSI=index-name1:attr-name1:data-type] [[,] WITH LSI=index-name2:attr-name2:data-type:*] [[,] WITH LSI=index-name2:attr-name2:data-type:nonKeyAttr1,nonKeyAttr2,nonKeyAttr3,...] [[,] WITH LSI...] [[,] WITH CLASS=<table-class>] - PK: partition key, format name:type (type is one of String, Number, Binary). - SK: sort key, format name:type (type is one of String, Number, Binary). - LSI: local secondary index, format index-name:attr-name:type[:projectionAttrs], where: - type is one of String, Number, Binary. - projectionAttrs=*: all attributes from the original table are included in projection (ProjectionType=ALL). - projectionAttrs=attr1,attr2,...: specified attributes from the original table are included in projection (ProjectionType=INCLUDE). - projectionAttrs is not specified: only key attributes are included in projection (ProjectionType=KEYS_ONLY). - RCU: an integer specifying DynamoDB's read capacity. - WCU: an integer specifying DynamoDB's write capacity. - CLASS: table class, either STANDARD (default) or STANDARD_IA. - If "IF NOT EXISTS" is specified, Exec will silently swallow the error "ResourceInUseException". - Note: if RCU and WRU are both 0 or not specified, table will be created with PAY_PER_REQUEST billing mode; otherwise table will be creatd with PROVISIONED mode. - Note: there must be at least one space before the WITH keyword.
func (*StmtCreateTable) ExecContext ¶
func (s *StmtCreateTable) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/Exec.
@Available since v0.2.0
func (*StmtCreateTable) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtCreateTable) QueryContext ¶
func (s *StmtCreateTable) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtDelete ¶
type StmtDelete struct {
*StmtExecutable
}
StmtDelete implements "DELETE" statement.
Syntax: follow "PartiQL delete statements for DynamoDB" https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.delete.html
Note: StmtDelete returns the deleted item by appending "RETURNING ALL OLD *" to the statement.
func (*StmtDelete) ExecContext ¶
func (s *StmtDelete) ExecContext(ctx context.Context, values []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtDelete) QueryContext ¶
func (s *StmtDelete) QueryContext(ctx context.Context, values []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext.
@Available since v0.2.0
type StmtDescribeGSI ¶
type StmtDescribeGSI struct { *Stmt // contains filtered or unexported fields }
StmtDescribeGSI implements "DESCRIBE GSI" statement.
Syntax:
DESCRIBE GSI <index-name> ON <table-name>
func (*StmtDescribeGSI) Exec ¶
Exec implements driver.Stmt/Exec. This function is not implemented, use Query instead.
func (*StmtDescribeGSI) ExecContext ¶
func (s *StmtDescribeGSI) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext. This function is not implemented, use QueryContext instead.
func (*StmtDescribeGSI) QueryContext ¶
func (s *StmtDescribeGSI) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext.
@Available since v0.2.0
type StmtDescribeLSI ¶
type StmtDescribeLSI struct { *Stmt // contains filtered or unexported fields }
StmtDescribeLSI implements "DESCRIBE LSI" statement.
Syntax:
DESCRIBE LSI <index-name> ON <table-name>
func (*StmtDescribeLSI) Exec ¶
Exec implements driver.Stmt/Exec. This function is not implemented, use Query instead.
func (*StmtDescribeLSI) ExecContext ¶
func (s *StmtDescribeLSI) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext. This function is not implemented, use QueryContext instead.
func (*StmtDescribeLSI) QueryContext ¶
func (s *StmtDescribeLSI) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext.
@Available since v0.2.0
type StmtDescribeTable ¶
type StmtDescribeTable struct { *Stmt // contains filtered or unexported fields }
StmtDescribeTable implements "DESCRIBE TABLE" operation.
Syntax:
DESCRIBE TABLE <table-name>
func (*StmtDescribeTable) Exec ¶
Exec implements driver.Stmt/Exec. This function is not implemented, use Query instead.
func (*StmtDescribeTable) ExecContext ¶
func (s *StmtDescribeTable) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext. This function is not implemented, use QueryContext instead.
func (*StmtDescribeTable) QueryContext ¶
func (s *StmtDescribeTable) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/Query.
@Available since v0.2.0
type StmtDropGSI ¶
type StmtDropGSI struct { *Stmt // contains filtered or unexported fields }
StmtDropGSI implements "DROP GSI" statement.
Syntax:
DROP GSI [IF EXISTS] <index-name> ON <table-name>
If "IF EXISTS" is specified, Exec will silently swallow the error "ResourceNotFoundException".
func (*StmtDropGSI) ExecContext ¶
func (s *StmtDropGSI) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtDropGSI) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtDropGSI) QueryContext ¶
func (s *StmtDropGSI) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtDropTable ¶
type StmtDropTable struct { *Stmt // contains filtered or unexported fields }
StmtDropTable implements "DROP TABLE" statement.
Syntax:
DROP TABLE [IF EXISTS] <table-name>
If "IF EXISTS" is specified, Exec will silently swallow the error "ResourceNotFoundException".
func (*StmtDropTable) ExecContext ¶
func (s *StmtDropTable) ExecContext(ctx context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/Exec.
@Available since v0.2.0
func (*StmtDropTable) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtDropTable) QueryContext ¶
func (s *StmtDropTable) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtExecutable ¶
type StmtExecutable struct {
*Stmt
}
StmtExecutable is the base implementation for INSERT, SELECT, UPDATE and DELETE statements.
type StmtInsert ¶
type StmtInsert struct {
*StmtExecutable
}
StmtInsert implements "INSERT" statement.
Syntax: follow "PartiQL insert statements for DynamoDB" https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.insert.html
func (*StmtInsert) ExecContext ¶
func (s *StmtInsert) ExecContext(ctx context.Context, values []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtInsert) Query ¶
Query implements driver.Stmt/Query. This function is not implemented, use Exec instead.
func (*StmtInsert) QueryContext ¶
func (s *StmtInsert) QueryContext(_ context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext. This function is not implemented, use ExecContext instead.
type StmtListTables ¶
type StmtListTables struct {
*Stmt
}
StmtListTables implements "LIST TABLES" statement.
Syntax:
LIST TABLES|TABLE
func (*StmtListTables) Exec ¶
Exec implements driver.Stmt/Exec. This function is not implemented, use Query instead.
func (*StmtListTables) ExecContext ¶
func (s *StmtListTables) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/Exec. This function is not implemented, use QueryContext instead.
func (*StmtListTables) QueryContext ¶
func (s *StmtListTables) QueryContext(ctx context.Context, _ []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext.
@Available since v0.2.0
type StmtSelect ¶
type StmtSelect struct { *StmtExecutable // contains filtered or unexported fields }
StmtSelect implements "SELECT" statement.
Syntax: follow "PartiQL select statements for DynamoDB" https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.select.html
@Since v0.3.0 support LIMIT clause
@Since v0.4.0 support WITH consistency=strong clause
func (*StmtSelect) Exec ¶
Exec implements driver.Stmt/Exec. This function is not implemented, use Query instead.
func (*StmtSelect) ExecContext ¶
func (s *StmtSelect) ExecContext(_ context.Context, _ []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext. This function is not implemented, use QueryContext instead.
func (*StmtSelect) QueryContext ¶
func (s *StmtSelect) QueryContext(ctx context.Context, values []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext.
@Available since v0.2.0
type StmtUpdate ¶
type StmtUpdate struct {
*StmtExecutable
}
StmtUpdate implements "UPDATE" statement.
Syntax: follow "PartiQL update statements for DynamoDB" https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.update.html
Note: StmtUpdate returns the updated item by appending "RETURNING ALL OLD *" to the statement.
func (*StmtUpdate) ExecContext ¶
func (s *StmtUpdate) ExecContext(ctx context.Context, values []driver.NamedValue) (driver.Result, error)
ExecContext implements driver.StmtExecContext/ExecContext.
@Available since v0.2.0
func (*StmtUpdate) QueryContext ¶
func (s *StmtUpdate) QueryContext(ctx context.Context, values []driver.NamedValue) (driver.Rows, error)
QueryContext implements driver.StmtQueryContext/QueryContext.
@Available since v0.2.0
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is AWS DynamoDB implementation of driver.Tx.
@Available since v0.2.0
type TxResultNoResultSet ¶
type TxResultNoResultSet struct {
// contains filtered or unexported fields
}
TxResultNoResultSet is transaction-aware version of ResultNoResultSet.
@Available since v0.2.0
func (*TxResultNoResultSet) LastInsertId ¶
func (t *TxResultNoResultSet) LastInsertId() (int64, error)
LastInsertId implements driver.Result/LastInsertId.
func (*TxResultNoResultSet) RowsAffected ¶
func (t *TxResultNoResultSet) RowsAffected() (int64, error)
RowsAffected implements driver.Result/RowsAffected.