Documentation ¶
Index ¶
- func ComputeShardId(NumberOfShards int, key string) int
- func DoesTableExists(dbpool *pgxpool.Pool, schemaName, tableName string) (bool, error)
- func GetObjectTypesFromDominsKeyJson(domainKeysJson string, defaultValue string) (*[]string, error)
- func IsSessionExists(dbpool *pgxpool.Pool, sessionId string) (bool, error)
- func RegisterSession(dbpool *pgxpool.Pool, sourceType, client string, sessionId string, ...) error
- func TableExists(dbpool *pgxpool.Pool, schema, table string) (exists bool, err error)
- func ToPgType(dt string) string
- type ColumnDefinition
- type ConstraintDefinition
- type DomainKeyInfo
- type HeadersAndDomainKeysInfo
- func (dkInfo *HeadersAndDomainKeysInfo) ComputeGroupingKey(NumberOfShards int, objectType *string, record *[]string, recordTypeOffset int, ...) (string, int, error)
- func (dkInfo *HeadersAndDomainKeysInfo) ComputeGroupingKeyI(NumberOfShards int, objectType *string, record *[]interface{}) (string, int, error)
- func (dkInfo *HeadersAndDomainKeysInfo) CreateStagingTable(dbpool *pgxpool.Pool, tableName string) (err error)
- func (dkInfo *HeadersAndDomainKeysInfo) GetHeaderPos() []int
- func (dkInfo *HeadersAndDomainKeysInfo) Initialize(mainObjectType string, domainKeysJson *string) error
- func (dkInfo *HeadersAndDomainKeysInfo) InitializeDomainTable(domainHeaders *[]string, mainObjectType string, domainKeysJson *string) error
- func (dkInfo *HeadersAndDomainKeysInfo) InitializeStagingTable(rawHeaders *[]string, mainObjectType string, domainKeysJson *string, ...) error
- func (dkInfo *HeadersAndDomainKeysInfo) IsDomainKeyIsJetsKey(objectType *string) bool
- func (dkInfo *HeadersAndDomainKeysInfo) String() string
- type IndexDefinition
- type TableDefinition
- func (tableDefinition *TableDefinition) CreateTable(dbpool *pgxpool.Pool) error
- func (tableDefinition *TableDefinition) DropTable(dbpool *pgxpool.Pool) error
- func (tableDefinition *TableDefinition) UpdateTable(dbpool *pgxpool.Pool, existingSchema *TableDefinition) error
- func (tableDefinition *TableDefinition) UpdateTableSchema(dbpool *pgxpool.Pool, dropExisting bool) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeShardId ¶
func DoesTableExists ¶
func GetObjectTypesFromDominsKeyJson ¶
Utility Methods
func IsSessionExists ¶
Utility function to check if session exist
func RegisterSession ¶
func RegisterSession(dbpool *pgxpool.Pool, sourceType, client string, sessionId string, sourcePeriodKey int) error
Register the session in session_registry, sourceType is the source_type of the entity saved on that session_id, which is "file" for loader and "domain_table" for server
func TableExists ¶
Types ¶
type ColumnDefinition ¶
type ColumnDefinition struct { ColumnName string `json:"columnName"` Description string `json:"description"` DataType string `json:"dataType"` Default string `json:"default"` IsArray bool `json:"isArray"` IsNotNull bool `json:"isNotNull"` Deprecated bool `json:"deprecated"` Deleted bool `json:"deleted"` IsPK bool `json:"isPK"` }
type ConstraintDefinition ¶
type DomainKeyInfo ¶
type DomainKeyInfo struct { // list of input column name making the domain key ColumnNames []string // list of input column position making the domain key ColumnPos []int // list of pre-processing functions for the input column (one per column) PreprocessFnc []string // Object type associated with the Domain Key ObjectType string // Column position of column `objectType`:domain_key in the output table DomainKeyPos int // Column position of column `objectType`:shard_id in the output table ShardIdPos int }
func (*DomainKeyInfo) String ¶
func (dk *DomainKeyInfo) String() string
type HeadersAndDomainKeysInfo ¶
type HeadersAndDomainKeysInfo struct { TableName string RawHeaders []string Headers []string HashingOverriden bool HashingAlgo string HashingSeed uuid.UUID // key is the header HeadersPosMap map[string]int // key is ObjectType of DomainKeyInfo DomainKeysInfoMap map[string]*DomainKeyInfo // Reserved columns removed from RawHeaders and included in Headers ReservedColumns map[string]bool FillerColumns map[string]bool // column prefix used for fixed-width input record // The prefix is the first record type (the one with offset == 0) // This is empty string for non fixed-width records, therefore ignored FixedWidthColumnPrefix string }
func NewHeadersAndDomainKeysInfo ¶
func NewHeadersAndDomainKeysInfo(tableName string) (*HeadersAndDomainKeysInfo, error)
func (*HeadersAndDomainKeysInfo) ComputeGroupingKey ¶
func (*HeadersAndDomainKeysInfo) ComputeGroupingKeyI ¶
func (dkInfo *HeadersAndDomainKeysInfo) ComputeGroupingKeyI(NumberOfShards int, objectType *string, record *[]interface{}) (string, int, error)
Alternate version for output records - same as ComputeGroupingKey using interface{} as record
func (*HeadersAndDomainKeysInfo) CreateStagingTable ¶
func (dkInfo *HeadersAndDomainKeysInfo) CreateStagingTable(dbpool *pgxpool.Pool, tableName string) (err error)
Create the Staging Table
func (*HeadersAndDomainKeysInfo) GetHeaderPos ¶
func (dkInfo *HeadersAndDomainKeysInfo) GetHeaderPos() []int
func (*HeadersAndDomainKeysInfo) Initialize ¶
func (dkInfo *HeadersAndDomainKeysInfo) Initialize(mainObjectType string, domainKeysJson *string) error
initialize (domainKeysJson string) -------------------------------------------------------------------------------------- Compute output table columns and associated domain keys passing domainKeysJson as argument for completeness
func (*HeadersAndDomainKeysInfo) InitializeDomainTable ¶
func (dkInfo *HeadersAndDomainKeysInfo) InitializeDomainTable(domainHeaders *[]string, mainObjectType string, domainKeysJson *string) error
func (*HeadersAndDomainKeysInfo) InitializeStagingTable ¶
func (*HeadersAndDomainKeysInfo) IsDomainKeyIsJetsKey ¶
func (dkInfo *HeadersAndDomainKeysInfo) IsDomainKeyIsJetsKey(objectType *string) bool
func (*HeadersAndDomainKeysInfo) String ¶
func (dkInfo *HeadersAndDomainKeysInfo) String() string
type IndexDefinition ¶
type TableDefinition ¶
type TableDefinition struct { SchemaName string `json:"schemaName"` TableName string `json:"tableName"` Columns []ColumnDefinition `json:"columns"` Indexes []IndexDefinition `json:"indexes"` TableConstraints []ConstraintDefinition `json:"tableConstraints"` Deleted bool `json:"deleted"` }
Define Database Table Structure This table/column definition structure is used by the api services and by update_db.
func GetTableSchema ¶
func (*TableDefinition) CreateTable ¶
func (tableDefinition *TableDefinition) CreateTable(dbpool *pgxpool.Pool) error
func (*TableDefinition) DropTable ¶
func (tableDefinition *TableDefinition) DropTable(dbpool *pgxpool.Pool) error
func (*TableDefinition) UpdateTable ¶
func (tableDefinition *TableDefinition) UpdateTable(dbpool *pgxpool.Pool, existingSchema *TableDefinition) error
func (*TableDefinition) UpdateTableSchema ¶
func (tableDefinition *TableDefinition) UpdateTableSchema(dbpool *pgxpool.Pool, dropExisting bool) (err error)
TableDefinition Methods -----------------------