models

package
v0.0.0-...-95bcf68 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package models implements all the structs required by application

Index

Constants

This section is empty.

Variables

View Source
var ColumnToOriginalCol map[string]string

ColumnToOriginalCol for Original column map

View Source
var DbConfigMap map[string]TableConfig
View Source
var OriginalColResponse map[string]string

OriginalColResponse for Original Column Response

View Source
var SpannerTableMap = make(map[string]string)

SpannerTableMap for spanner column map

View Source
var TableColChangeMap map[string]struct{}

TableColChangeMap for changed columns map

View Source
var TableColumnMap map[string][]string

TableColumnMap - this contains the list of columns for the tables

View Source
var TableDDL map[string]map[string]string

TableDDL - this contains the DDL

Functions

This section is empty.

Types

type BatchDeleteItem

type BatchDeleteItem struct {
	Key map[string]*dynamodb.AttributeValue `json:"Key"`
}

BatchDeleteItem is for BatchWriteSubItems

type BatchGetMeta

type BatchGetMeta struct {
	RequestItems map[string]BatchGetWithProjectionMeta `json:"RequestItems"`
}

BatchGetMeta struct

type BatchGetWithProjectionMeta

type BatchGetWithProjectionMeta struct {
	TableName                string                                `json:"TableName"`
	KeyArray                 []map[string]interface{}              `json:"KeyArray"`
	ProjectionExpression     string                                `json:"ProjectionExpression"`
	ExpressionAttributeNames map[string]string                     `json:"ExpressionAttributeNames"`
	Keys                     []map[string]*dynamodb.AttributeValue `json:"Keys"`
}

BatchGetWithProjectionMeta struct

type BatchMeta

type BatchMeta struct {
	TableName    string                                `json:"TableName"`
	KeyArray     []map[string]interface{}              `json:"KeyArray"`
	DynamoObject []map[string]*dynamodb.AttributeValue `json:"DynamoObject"`
}

BatchMeta struct

type BatchMetaUpdate

type BatchMetaUpdate struct {
	TableName    string                                `json:"TableName"`
	ArrAttrMap   []map[string]interface{}              `json:"ArrAttrMap"`
	DynamoObject []map[string]*dynamodb.AttributeValue `json:"DynamoObject"`
}

BatchMetaUpdate struct

type BatchPutItem

type BatchPutItem struct {
	Item map[string]*dynamodb.AttributeValue `json:"Item"`
}

BatchPutItem is for BatchWriteSubItems

type BatchWriteItem

type BatchWriteItem struct {
	RequestItems map[string][]BatchWriteSubItems `json:"RequestItems"`
}

BatchWriteItem for Batch Operation

type BatchWriteItemResponse

type BatchWriteItemResponse struct {
	UnprocessedItems map[string][]BatchWriteSubItems `json:"UnprocessedItems"`
}

BatchWriteItemResponse for Batch Operation

type BatchWriteSubItems

type BatchWriteSubItems struct {
	DelReq BatchDeleteItem `json:"DeleteRequest"`
	PutReq BatchPutItem    `json:"PutRequest"`
}

BatchWriteSubItems is for BatchWriteItem

type BulkDelete

type BulkDelete struct {
	TableName          string                                `json:"TableName"`
	PrimaryKeyMapArray []map[string]interface{}              `json:"KeyArray"`
	DynamoObject       []map[string]*dynamodb.AttributeValue `json:"DynamoObject"`
}

BulkDelete struct

type ConditionCheckItem

type ConditionCheckItem struct {
	Key map[string]interface{} `json:"Key"`
}

type ConditionCheckRequest

type ConditionCheckRequest struct {
	TableName                 string                              `json:"TableName"`
	Key                       map[string]*dynamodb.AttributeValue `json:"Key"`
	PrimaryKeyMap             map[string]interface{}              `json:"PrimaryKeyMap"`
	ReturnValues              string                              `json:"ReturnValuesOnConditionCheckFailure"`
	ConditionExpression       string                              `json:"ConditionExpression"`
	ExpressionAttributeMap    map[string]interface{}              `json:"ExpressionAttributeMap"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
}

type Config

type Config struct {
	Spanner   SpannerConfig `yaml:"spanner"`
	Otel      *OtelConfig   `yaml:"otel"`
	UserAgent string
}
var GlobalConfig *Config

type ConfigControllerModel

type ConfigControllerModel struct {
	Mux               sync.RWMutex
	UniqueVal         string
	CornTime          string
	StopConfigManager bool
	ReadMap           map[string]struct{}
	WriteMap          map[string]struct{}
	StreamEnable      map[string]struct{}
}

ConfigControllerModel for Config controller

var ConfigController *ConfigControllerModel

ConfigController object for ConfigControllerModel

type ConsumedCapacity

type ConsumedCapacity struct {
	TableName     string  `json:"TableName"`
	CapacityUnits float64 `json:"CapacityUnits"`
}

type Delete

type Delete struct {
	TableName                 string                              `json:"TableName"`
	PrimaryKeyMap             map[string]interface{}              `json:"PrimaryKeyMap"`
	ConditionExpression       string                              `json:"ConditionExpression"`
	ExpressionAttributeMap    map[string]interface{}              `json:"ExpressionAttributeMap"`
	Key                       map[string]*dynamodb.AttributeValue `json:"Key"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
}

Delete struct

type DeleteItem

type DeleteItem struct {
	Key map[string]interface{} `json:"Key"`
}

type DeleteItemRequest

type DeleteItemRequest struct {
	TableName                 string                              `json:"TableName"`
	PrimaryKeyMap             map[string]interface{}              `json:"PrimaryKeyMap"`
	ConditionExpression       string                              `json:"ConditionExpression"`
	ExpressionAttributeMap    map[string]interface{}              `json:"ExpressionAttributeMap"`
	Key                       map[string]*dynamodb.AttributeValue `json:"Key"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	ReturnValues              string                              `json:"ReturnValuesOnConditionCheckFailure"`
}

DeleteItemRequest represents the structure of a Delete request.

type Eval

type Eval struct {
	Cond       *vm.Program
	Attributes []string
	Cols       []string
	Tokens     []string
	ValueMap   map[string]interface{}
}

Eval for Evaluation expression

type ExecuteStatement

type ExecuteStatement struct {
	Limit        int64                      `json:"Limit"`
	NextToken    int64                      `json:"NextToken"`
	Parameters   []*dynamodb.AttributeValue `json:"Parameters"`
	ReturnValues string                     `json:"ReturnValues"`
	Statement    string                     `json:"Statement"`
	TableName    string                     `json:"TableName"`
	AttrParams   []interface{}              `json:"AttrParams"`
}

type ExecuteStatementQuery

type ExecuteStatementQuery struct {
	PartiQl      string
	Params       map[string]interface{}
	SQLStatement spanner.Statement
}

type GetItemMeta

type GetItemMeta struct {
	TableName                string                              `json:"TableName"`
	PrimaryKeyMap            map[string]interface{}              `json:"PrimaryKeyMap"`
	ProjectionExpression     string                              `json:"ProjectionExpression"`
	ExpressionAttributeNames map[string]string                   `json:"ExpressionAttributeNames"`
	Key                      map[string]*dynamodb.AttributeValue `json:"Key"`
}

GetItemMeta struct

type GetItemRequest

type GetItemRequest struct {
	TableName                string                              `json:"TableName"`
	Keys                     map[string]*dynamodb.AttributeValue `json:"Key"`
	KeyArray                 []map[string]interface{}            `json:"KeyArray"`
	ProjectionExpression     string                              `json:"ProjectionExpression,omitempty"`
	ExpressionAttributeNames map[string]string                   `json:"ExpressionAttributeNames,omitempty"`
}

GetItemRequest represents the structure of a Get request.

type GetKeyMeta

type GetKeyMeta struct {
	Key          string                              `json:"Key"`
	Type         string                              `json:"Type"`
	DynamoObject map[string]*dynamodb.AttributeValue `json:"DynamoObject"`
}

GetKeyMeta struct

type ItemCollectionMetrics

type ItemCollectionMetrics struct {
	ItemCollectionSizeEstimate int64 `json:"ItemCollectionSizeEstimate"`
}

ItemCollectionMetrics represents the item collection metrics. (Add more fields as needed)

type Meta

type Meta struct {
	TableName                 string                              `json:"TableName"`
	AttrMap                   map[string]interface{}              `json:"AttrMap"`
	ReturnValues              string                              `json:"ReturnValues"`
	ConditionExpression       string                              `json:"ConditionExpression"`
	ExpressionAttributeMap    map[string]interface{}              `json:"ExpressionAttributeMap"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
	Item                      map[string]*dynamodb.AttributeValue `json:"Item"`
}

Meta struct

type Operation

type Operation struct {
	MaxCommitDelay   uint64 `yaml:"maxCommitDelay"`
	ReplayProtection bool   `yaml:"replayProtection"`
}

Spanner read/write operation settings.

type OtelConfig

type OtelConfig struct {
	Enabled                  bool   `yaml:"enabled"`
	EnabledClientSideMetrics bool   `yaml:"enabledClientSideMetrics"`
	ServiceName              string `yaml:"serviceName"`
	HealthCheck              struct {
		Enabled  bool   `yaml:"enabled"`
		Endpoint string `yaml:"endpoint"`
	} `yaml:"healthcheck"`
	Metrics struct {
		Enabled  bool   `yaml:"enabled"`
		Endpoint string `yaml:"endpoint"`
	} `yaml:"metrics"`
	Traces struct {
		Enabled       bool    `yaml:"enabled"`
		Endpoint      string  `yaml:"endpoint"`
		SamplingRatio float64 `yaml:"samplingRatio"`
	} `yaml:"traces"`
}

OtelConfig defines the structure of the YAML configuration

type Proxy

type Proxy struct {
	Context      context.Context
	OtelInst     *otelgo.OpenTelemetry // Exported field (starts with uppercase)
	OtelShutdown func(context.Context) error
}
var GlobalProxy *Proxy

type PutItem

type PutItem struct {
	Item map[string]interface{} `json:"Item"`
}

type PutItemRequest

type PutItemRequest struct {
	TableName                 string                              `json:"TableName"`
	AttrMap                   map[string]interface{}              `json:"AttrMap"`
	ReturnValues              string                              `json:"ReturnValuesOnConditionCheckFailure"`
	ConditionExpression       string                              `json:"ConditionExpression"`
	ExpressionAttributeMap    map[string]interface{}              `json:"ExpressionAttributeMap"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
	Item                      map[string]*dynamodb.AttributeValue `json:"Item"`
}

PutItemRequest represents the structure of a Put request.

type Query

type Query struct {
	TableName                 string                              `json:"TableName"`
	IndexName                 string                              `json:"IndexName"`
	OnlyCount                 bool                                `json:"OnlyCount"`
	Limit                     int64                               `json:"Limit"`
	SortAscending             bool                                `json:"ScanIndexForward"`
	StartFrom                 map[string]interface{}              `json:"StartFrom"`
	ProjectionExpression      string                              `json:"ProjectionExpression"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	FilterExp                 string                              `json:"FilterExpression"`
	RangeExp                  string                              `json:"KeyConditionExpression"`
	RangeValMap               map[string]interface{}              `json:"RangeValMap"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
	ExclusiveStartKey         map[string]*dynamodb.AttributeValue `json:"ExclusiveStartKey"`
	Select                    string                              `json:"Select"`
}

Query struct

type ResponseItem

type ResponseItem struct {
	TableName interface{}            `json:"TableName"`
	Item      map[string]interface{} `json:"Item"`
}

type ScanMeta

type ScanMeta struct {
	TableName                 string                              `json:"TableName"`
	IndexName                 string                              `json:"IndexName"`
	OnlyCount                 bool                                `json:"OnlyCount"`
	Select                    string                              `json:"Select"`
	Limit                     int64                               `json:"Limit"`
	StartFrom                 map[string]interface{}              `json:"StartFrom"`
	ExclusiveStartKey         map[string]*dynamodb.AttributeValue `json:"ExclusiveStartKey"`
	FilterExpression          string                              `json:"FilterExpression"`
	ProjectionExpression      string                              `json:"ProjectionExpression"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	ExpressionAttributeMap    map[string]interface{}              `json:"ExpressionAttributeMap"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
}

ScanMeta for Scan request

type Session

type Session struct {
	Min          uint64 `yaml:"min"`
	Max          uint64 `yaml:"max"`
	GrpcChannels int    `yaml:"grpcChannels"`
}

type SetKeyMeta

type SetKeyMeta struct {
	Key          string                              `json:"Key"`
	Type         string                              `json:"Type"`
	Value        string                              `json:"Value"`
	DynamoObject map[string]*dynamodb.AttributeValue `json:"DynamoObject"`
}

SetKeyMeta struct

type SpannerConfig

type SpannerConfig struct {
	ProjectID        string  `yaml:"project_id"`
	InstanceID       string  `yaml:"instance_id"`
	DatabaseName     string  `yaml:"database_name"`
	QueryLimit       int64   `yaml:"query_limit"`
	DynamoQueryLimit int32   `yaml:"dynamo_query_limit"` //dynamo_query_limit
	Session          Session `yaml:"Session"`
}

type StreamDataModel

type StreamDataModel struct {
	OldImage       map[string]interface{} `json:"OldImage"`
	NewImage       map[string]interface{} `json:"NewImage"`
	Keys           map[string]interface{} `json:"Keys"`
	Timestamp      int64                  `json:"Timestamp"`
	Table          string                 `json:"TableName"`
	EventName      string                 `json:"EventName"`
	SequenceNumber int64                  `json:"SequenceNumber"`
	EventID        string                 `json:"EventId"`
	EventSourceArn string                 `json:"EventSourceArn"`
}

StreamDataModel for streaming data

type TableConfig

type TableConfig struct {
	PartitionKey     string                 `json:"PartitionKey,omitempty"`
	SortKey          string                 `json:"SortKey,omitempty"`
	Indices          map[string]TableConfig `json:"Indices,omitempty"`
	GCSSourcePath    string                 `json:"GcsSourcePath,omitempty"`
	DDBIndexName     string                 `json:"DdbIndexName,omitempty"`
	SpannerIndexName string                 `json:"SpannerIndexName,omitempty"`
	IsPadded         bool                   `json:"IsPadded,omitempty"`
	IsComplement     bool                   `json:"IsComplement,omitempty"`
	TableSource      string                 `json:"TableSource,omitempty"`
	ActualTable      string                 `json:"ActualTable,omitempty"`
}

TableConfig for Configuration table

type TransactGetItem

type TransactGetItem struct {
	Get GetItemRequest `json:"Get"`
}

TransactGetItem represents a single Get operation inside TransactGetItems.

type TransactGetItemResponse

type TransactGetItemResponse struct {
	TableName string                 `json:"TableName"`
	Item      map[string]interface{} `json:"Item"`
}

type TransactGetItemsRequest

type TransactGetItemsRequest struct {
	TransactItems          []TransactGetItem `json:"TransactItems"`
	ReturnConsumedCapacity string            `json:"ReturnConsumedCapacity,omitempty"`
}

TransactGetItemsRequest represents the input structure for TransactGetItems API.

type TransactGetItemsResponse

type TransactGetItemsResponse struct {
	Responses []TransactGetItemResponse `json:"Responses"`
}

TransactGetItemsResponse represents the overall response structure for multiple TransactGetItems.

type TransactWriteItem

type TransactWriteItem struct {
	Put            PutItemRequest        `json:"Put,omitempty"`
	Update         UpdateAttr            `json:"Update,omitempty"`
	Delete         DeleteItemRequest     `json:"Delete,omitempty"`
	ConditionCheck ConditionCheckRequest `json:"ConditionCheck,omitempty"`
}

TransactWriteItem represents a single Put, Update, or Delete operation inside TransactWriteItems.

type TransactWriteItemOutput

type TransactWriteItemOutput struct {
	Put            *PutItem    `json:"Put,omitempty"`
	Update         *UpdateItem `json:"Update,omitempty"`
	Delete         *DeleteItem `json:"Delete,omitempty"`
	ConditionCheck *struct{}   `json:"ConditionCheck,omitempty"`
}

type TransactWriteItemsOutput

type TransactWriteItemsOutput struct {
	Item []map[string]interface{} `json:"Item"`
}

type TransactWriteItemsRequest

type TransactWriteItemsRequest struct {
	TransactItems               []TransactWriteItem `json:"TransactItems"`
	ReturnConsumedCapacity      string              `json:"ReturnConsumedCapacity,omitempty"`
	ReturnItemCollectionMetrics string              `json:"ReturnItemCollectionMetrics,omitempty"` // Added for consistency with DynamoDB
}

TransactWriteItemsRequest represents the input structure for TransactWriteItems API.

type TransactWriteItemsResponse

type TransactWriteItemsResponse struct {
	ConsumedCapacity      ConsumedCapacity                 `json:"ConsumedCapacity,omitempty"`      // Added for consistency
	ItemCollectionMetrics map[string]ItemCollectionMetrics `json:"ItemCollectionMetrics,omitempty"` // Added for consistency
}

type UpdateAttr

type UpdateAttr struct {
	TableName                 string                              `json:"TableName"`
	PrimaryKeyMap             map[string]interface{}              `json:"PrimaryKeyMap"`
	ReturnValues              string                              `json:"ReturnValues"`
	UpdateExpression          string                              `json:"UpdateExpression"`
	ConditionExpression       string                              `json:"ConditionExpression"`
	ExpressionAttributeMap    map[string]interface{}              `json:"AttrVals"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames"`
	Key                       map[string]*dynamodb.AttributeValue `json:"Key"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues"`
}

UpdateAttr struct

type UpdateExpressionCondition

type UpdateExpressionCondition struct {
	Field     []string
	Value     []string
	Condition []string
	ActionVal string
	AddValues map[string]float64
}

UpdateExpressionCondition for Update Condition

type UpdateItem

type UpdateItem struct {
	Key map[string]interface{} `json:"Key"`
}

type UpdateItemRequest

type UpdateItemRequest struct {
	TableName                 string                              `json:"TableName"`
	Key                       map[string]*dynamodb.AttributeValue `json:"Key"`
	KeyArray                  map[string]interface{}              `json:"KeyArray"`
	UpdateExpression          string                              `json:"UpdateExpression"`
	ExpressionAttributeNames  map[string]string                   `json:"ExpressionAttributeNames,omitempty"`
	ExpressionAttributeValues map[string]*dynamodb.AttributeValue `json:"ExpressionAttributeValues,omitempty"`
	ReturnValues              string                              `json:"ReturnValuesOnConditionCheckFailure"`
}

UpdateItemRequest represents the structure of an Update request.

Jump to

Keyboard shortcuts

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