Documentation
¶
Index ¶
- Constants
- func BuildBigtableParams(b *types.ExecutableSelectQuery) (map[string]any, error)
- func BuildParamTypes(b *types.PreparedSelectQuery) map[string]bigtable.SQLType
- func GenerateAppliedRowsResult(keyspace types.Keyspace, table types.TableName, applied bool) *message.RowsResult
- func GetProfileId(profileId string) string
- type BigtableAdapter
- func (btc *BigtableAdapter) ApplyBulkMutation(ctx context.Context, keyspace types.Keyspace, tableName types.TableName, ...) (BulkOperationResponse, error)
- func (btc *BigtableAdapter) DeleteRow(ctx context.Context, deleteQueryData *types.BoundDeleteQuery) (*message.RowsResult, error)
- func (btc *BigtableAdapter) DropAllRows(ctx context.Context, data *types.TruncateTableStatementMap) error
- func (btc *BigtableAdapter) Execute(ctx context.Context, query types.IExecutableQuery) (message.Message, error)
- func (btc *BigtableAdapter) ExecutePreparedStatement(ctx context.Context, query *types.ExecutableSelectQuery) (*message.RowsResult, error)
- func (btc *BigtableAdapter) InsertRow(ctx context.Context, input *types.BigtableWriteMutation) (*message.RowsResult, error)
- func (btc *BigtableAdapter) PrepareStatement(ctx context.Context, query types.IPreparedQuery) (*bigtable.PreparedStatement, error)
- func (btc *BigtableAdapter) UpdateRow(ctx context.Context, input *types.BigtableWriteMutation) (*message.RowsResult, error)
- type BigtableBulkMutation
- type BulkOperationResponse
Constants ¶
const (
DefaultProfileId = "default"
)
Variables ¶
This section is empty.
Functions ¶
func BuildBigtableParams ¶
func BuildBigtableParams(b *types.ExecutableSelectQuery) (map[string]any, error)
func BuildParamTypes ¶
func BuildParamTypes(b *types.PreparedSelectQuery) map[string]bigtable.SQLType
func GenerateAppliedRowsResult ¶
func GenerateAppliedRowsResult(keyspace types.Keyspace, table types.TableName, applied bool) *message.RowsResult
GenerateAppliedRowsResult creates a RowsResult message to indicate whether a database operation was applied. It generates a single column row result with a boolean indicating the application status. it is specifically for if exists and if not exists queries
Parameters:
- keyspace: A string representing the name of the keyspace in which the table resides.
- tableName: A string representing the name of the table where the operation was attempted.
- applied: A boolean flag indicating whether the operation was successfully applied.
Returns: A pointer to a RowsResult object that contains metadata for a single boolean column denoting
the application status ([applied]) and the corresponding row data indicating true or false.
func GetProfileId ¶
GetProfileId returns the provided profile ID if it is not empty. If the provided profile ID is empty, it returns a default profile ID.
Types ¶
type BigtableAdapter ¶
func NewBigtableClient ¶
func NewBigtableClient(clients *types.BigtableClientManager, logger *zap.Logger, config *types.BigtableConfig, schemaManager *metadata.MetadataStore) *BigtableAdapter
func (*BigtableAdapter) ApplyBulkMutation ¶
func (btc *BigtableAdapter) ApplyBulkMutation(ctx context.Context, keyspace types.Keyspace, tableName types.TableName, mutationData []types.IBigtableMutation) (BulkOperationResponse, error)
ApplyBulkMutation - Applies bulk mutations to the specified bigtable table.
Parameters:
- ctx: Context for the operation, used for cancellation and deadlines.
- tableName: Columns of the table to apply bulk mutations to.
- mutationData: Slice of MutationData objects containing mutation details.
Returns:
- BulkOperationResponse: Response indicating the result of the bulk operation.
- error: Error if the bulk mutation fails.
func (*BigtableAdapter) DeleteRow ¶
func (btc *BigtableAdapter) DeleteRow(ctx context.Context, deleteQueryData *types.BoundDeleteQuery) (*message.RowsResult, error)
func (*BigtableAdapter) DropAllRows ¶
func (btc *BigtableAdapter) DropAllRows(ctx context.Context, data *types.TruncateTableStatementMap) error
func (*BigtableAdapter) Execute ¶
func (btc *BigtableAdapter) Execute(ctx context.Context, query types.IExecutableQuery) (message.Message, error)
func (*BigtableAdapter) ExecutePreparedStatement ¶
func (btc *BigtableAdapter) ExecutePreparedStatement(ctx context.Context, query *types.ExecutableSelectQuery) (*message.RowsResult, error)
ExecutePreparedStatement - Executes a prepared statement on Bigtable and returns the result. Parameters:
- ctx: Context for the operation, used for cancellation and deadlines.
- query: rh.QueryMetadata containing the query and parameters.
- preparedStmt: PreparedStatement object containing the prepared statement.
Returns:
- *message.RowsResult: The result of the select statement.
- time.Duration: The total elapsed time for the operation.
- error: Error if the statement preparation or execution fails.
func (*BigtableAdapter) InsertRow ¶
func (btc *BigtableAdapter) InsertRow(ctx context.Context, input *types.BigtableWriteMutation) (*message.RowsResult, error)
InsertRow - Inserts a row into the specified bigtable table.
Parameters:
- ctx: Context for the operation, used for cancellation and deadlines.
- data: PreparedInsertQuery object containing the table, row key, columns, values, and deleteColumnFamilies.
Returns:
- error: Error if the insertion fails.
func (*BigtableAdapter) PrepareStatement ¶
func (btc *BigtableAdapter) PrepareStatement(ctx context.Context, query types.IPreparedQuery) (*bigtable.PreparedStatement, error)
PrepareStatement prepares a query for execution using the bigtable SQL client.
func (*BigtableAdapter) UpdateRow ¶
func (btc *BigtableAdapter) UpdateRow(ctx context.Context, input *types.BigtableWriteMutation) (*message.RowsResult, error)
UpdateRow - Updates a row in the specified bigtable table.
Parameters:
- ctx: Context for the operation, used for cancellation and deadlines.
- data: PreparedUpdateQuery object containing the table, row key, columns, values, and DeleteColumnFamilies.
Returns:
- error: Error if the update fails.
type BigtableBulkMutation ¶
type BigtableBulkMutation struct {
// contains filtered or unexported fields
}
func NewBigtableBulkMutation ¶
func NewBigtableBulkMutation() *BigtableBulkMutation
func (*BigtableBulkMutation) AddMutation ¶
func (b *BigtableBulkMutation) AddMutation(mut types.IBigtableMutation)
func (*BigtableBulkMutation) Mutations ¶
func (b *BigtableBulkMutation) Mutations() map[types.TableName][]types.IBigtableMutation
type BulkOperationResponse ¶
type BulkOperationResponse struct {
FailedRows string
}