Documentation ¶
Index ¶
- Constants
- Variables
- func GetAffectedAndTransferringColumns(parameters map[string]*Parameter, driver *Driver) (affectedColumnsIdx []int, transferringColumnsIdx []int, err error)
- func TryRegisterCustomTypes(typeMap *pgtype.Map, types []*Type, silent bool)
- type AttNum
- type Check
- type Cmd
- type Column
- type ColumnProperties
- func (cp *ColumnProperties) SetAffected(v bool) *ColumnProperties
- func (cp *ColumnProperties) SetAllowedColumnTypes(v ...string) *ColumnProperties
- func (cp *ColumnProperties) SetMaxLength(v int) *ColumnProperties
- func (cp *ColumnProperties) SetNullable(v bool) *ColumnProperties
- func (cp *ColumnProperties) SetSkipOnNull(v bool) *ColumnProperties
- func (cp *ColumnProperties) SetSkipOriginalData(v bool) *ColumnProperties
- func (cp *ColumnProperties) SetUnique(v bool) *ColumnProperties
- type Constraint
- type CsvApi
- func (ca *CsvApi) Clean()
- func (ca *CsvApi) Decode(ctx context.Context) (RowDriver, error)
- func (ca *CsvApi) Encode(ctx context.Context, row RowDriver) (err error)
- func (ca *CsvApi) GetRowDriverFromRecord(r *Record) (RowDriver, error)
- func (ca *CsvApi) SetReader(r io.Reader)
- func (ca *CsvApi) SetRowDriverToRecord(rd RowDriver, r *Record) error
- func (ca *CsvApi) SetWriter(w io.Writer)
- type DefaultConstraintDefinition
- type Definition
- type Driver
- func (d *Driver) DecodeValueByColumnIdx(idx int, src []byte) (any, error)
- func (d *Driver) DecodeValueByColumnName(name string, src []byte) (any, error)
- func (d *Driver) DecodeValueByTypeName(name string, src []byte) (any, error)
- func (d *Driver) DecodeValueByTypeOid(oid uint32, src []byte) (any, error)
- func (d *Driver) EncodeValueByColumnIdx(idx int, src any, buf []byte) ([]byte, error)
- func (d *Driver) EncodeValueByColumnName(name string, src any, buf []byte) ([]byte, error)
- func (d *Driver) EncodeValueByTypeName(name string, src any, buf []byte) ([]byte, error)
- func (d *Driver) EncodeValueByTypeOid(oid uint32, src any, buf []byte) ([]byte, error)
- func (d *Driver) GetColumnByName(name string) (int, *Column, bool)
- func (d *Driver) ScanValueByColumnIdx(idx int, src []byte, dest any) error
- func (d *Driver) ScanValueByColumnName(name string, src []byte, dest any) error
- func (d *Driver) ScanValueByTypeName(name string, src []byte, dest any) error
- func (d *Driver) ScanValueByTypeOid(oid uint32, src []byte, dest any) error
- type Exclusion
- type ForeignKey
- type InteractionApi
- type JsonApi
- func (j *JsonApi) Clean()
- func (j *JsonApi) Decode(ctx context.Context) (RowDriver, error)
- func (j *JsonApi) Encode(ctx context.Context, row RowDriver) (err error)
- func (j *JsonApi) GetRowDriverFromRecord(r *Record) (RowDriver, error)
- func (j *JsonApi) SetReader(r io.Reader)
- func (j *JsonApi) SetRowDriverToRecord(rd RowDriver, r *Record) error
- func (j *JsonApi) SetWriter(w io.Writer)
- type LinkedTable
- type Meta
- type NewRowDriverFunc
- type NewTransformerFunc
- type Oid
- type Parameter
- func (p *Parameter) Copy() *Parameter
- func (p *Parameter) Init(driver *Driver, types []*Type, params []*Parameter, rawValue ParamsValue) (ValidationWarnings, error)
- func (p *Parameter) RawValue() ParamsValue
- func (p *Parameter) Scan(dest any) (empty bool, err error)
- func (p *Parameter) SetCastDbType(v string) *Parameter
- func (p *Parameter) SetDefaultValue(v ParamsValue) *Parameter
- func (p *Parameter) SetIsColumn(columnProperties *ColumnProperties) *Parameter
- func (p *Parameter) SetLinkParameter(name string) *Parameter
- func (p *Parameter) SetRawValueValidator(validator RawValueValidator) *Parameter
- func (p *Parameter) SetRequired(v bool) *Parameter
- func (p *Parameter) SetUnmarshaller(unmarshaller Unmarshaller) *Parameter
- func (p *Parameter) Value() (any, error)
- type Params
- type ParamsValue
- type PrimaryKey
- type RawRecord
- type RawRecordCsv
- type RawRecordStr
- type RawRecordText
- type RawValue
- type RawValueStr
- type RawValueValidator
- type Record
- func (r *Record) Encode() (RowDriver, error)
- func (r *Record) GetColumnValueByIdx(idx int) (*Value, error)
- func (r *Record) GetColumnValueByName(name string) (*Value, error)
- func (r *Record) GetRawColumnValueByIdx(idx int) (*RawValue, error)
- func (r *Record) GetRawColumnValueByName(name string) (*RawValue, error)
- func (r *Record) GetTuple() (Tuple, error)
- func (r *Record) ScanColumnValueByIdx(idx int, v any) (bool, error)
- func (r *Record) ScanColumnValueByName(name string, v any) (bool, error)
- func (r *Record) SetColumnValueByIdx(idx int, v any) error
- func (r *Record) SetColumnValueByName(name string, v any) error
- func (r *Record) SetRawColumnValueByIdx(idx int, value *RawValue) error
- func (r *Record) SetRawColumnValueByName(name string, value *RawValue) error
- func (r *Record) SetRow(row RowDriver)
- type RowDriver
- type RowDriverParams
- type Table
- type TextApi
- func (ta *TextApi) Clean()
- func (ta *TextApi) Decode(ctx context.Context) (RowDriver, error)
- func (ta *TextApi) Encode(ctx context.Context, row RowDriver) (err error)
- func (ta *TextApi) GetRowDriverFromRecord(r *Record) (RowDriver, error)
- func (ta *TextApi) SetReader(r io.Reader)
- func (ta *TextApi) SetRowDriverToRecord(rd RowDriver, r *Record) error
- func (ta *TextApi) SetWriter(w io.Writer)
- type Trace
- type Transformer
- type TriggerConstraint
- type Tuple
- type Type
- type Unique
- type Unmarshaller
- type ValidationWarning
- func (re *ValidationWarning) AddMeta(key string, value any) *ValidationWarning
- func (re *ValidationWarning) MakeHash()
- func (re *ValidationWarning) SetMsg(msg string) *ValidationWarning
- func (re *ValidationWarning) SetMsgf(msg string, args ...any) *ValidationWarning
- func (re *ValidationWarning) SetSeverity(severity string) *ValidationWarning
- func (re *ValidationWarning) SetTrace(value *Trace) *ValidationWarning
- type ValidationWarnings
- type Value
Constants ¶
const ( FkConstraintType = "ForeignKey" CheckConstraintType = "Check" NotNullConstraintType = "NotNull" PkConstraintType = "PrimaryKey" PkConstraintReferencesType = "PrimaryKeyReferences" UniqueConstraintType = "Unique" LengthConstraintType = "Length" ExclusionConstraintType = "Exclusion" TriggerConstraintType = "TriggerConstraint" )
const ( JsonModeName = "json" CsvModeName = "csv" TextModeName = "text" )
const ( JsonBytesFormatName = "bytes" JsonTextFormatName = "text" )
const ( ErrorValidationSeverity = "error" WarningValidationSeverity = "warning" InfoValidationSeverity = "info" DebugValidationSeverity = "debug" )
const (
RowDriverFormatParameterName = "format"
)
const WithoutMaxLength = -1
Variables ¶
var DefaultRowDriverParams = &RowDriverParams{ Name: CsvModeName, Params: map[string]interface{}{ "format": CsvModeName, }, }
var (
KindOfType = map[rune]string{
'b': "Base",
'c': "Composite",
'd': "Domain",
'e': "Enum",
'p': "PreSudo",
'r': "Range",
'm': "Multirange",
}
)
Functions ¶
Types ¶
type Check ¶
type Check DefaultConstraintDefinition
func (*Check) IsAffected ¶
func (c *Check) IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
type ColumnProperties ¶
type ColumnProperties struct { // Nullable - shows that transformer can produce NULL value for the column. Togather with Affected shows that // this parameter may generate null values and write it in this column. It only plays with Affected Nullable bool `mapstructure:"nullable" json:"nullable,omitempty"` // Unique - shows that transformer guarantee that every transformer call the value will be unique. It only plays // with Affected Unique bool `mapstructure:"unique" json:"unique,omitempty"` // Unique - defines max length of the value. It only plays with Affected. Togather with Affected shows // that values will not exceed the length of the column. It only plays with Affected MaxLength int `mapstructure:"max_length" json:"max_length,omitempty"` // Affected - shows assigned column name will be affected after the transformation Affected bool `mapstructure:"affected" json:"affected,omitempty"` // AllowedTypes - defines all the allowed column types in textual format. If not assigned (nil) then any // of the types is valid // TODO: AllowedTypes has a problem if we set int and our column is int2, then it cause an error though // it is workable case. Decide how to define subtype or type "aliases" references. // Also it has problem with custom type naming because it has schema name and type name. It might be better // to describe types with {{ schemaName }}.{{ typeName }}, but then we have to implement types classes // (such as textual, digits, etc.) AllowedTypes []string `mapstructure:"allowed_types" json:"allowed_types,omitempty"` // SkipOriginalData - Is transformer require original data or not SkipOriginalData bool `mapstructure:"skip_original_data" json:"skip_original_data,omitempty"` // TODO: Implement SkipOnNull // SkipOnNull - transformation for column with NULL is not expected SkipOnNull bool `mapstructure:"skip_on_null" json:"skip_on_null"` }
ColumnProperties - column-like parameter properties that would help to understand the affection on the consistency
func NewColumnProperties ¶
func NewColumnProperties() *ColumnProperties
func (*ColumnProperties) SetAffected ¶
func (cp *ColumnProperties) SetAffected(v bool) *ColumnProperties
func (*ColumnProperties) SetAllowedColumnTypes ¶
func (cp *ColumnProperties) SetAllowedColumnTypes(v ...string) *ColumnProperties
func (*ColumnProperties) SetMaxLength ¶
func (cp *ColumnProperties) SetMaxLength(v int) *ColumnProperties
func (*ColumnProperties) SetNullable ¶
func (cp *ColumnProperties) SetNullable(v bool) *ColumnProperties
func (*ColumnProperties) SetSkipOnNull ¶
func (cp *ColumnProperties) SetSkipOnNull(v bool) *ColumnProperties
func (*ColumnProperties) SetSkipOriginalData ¶
func (cp *ColumnProperties) SetSkipOriginalData(v bool) *ColumnProperties
func (*ColumnProperties) SetUnique ¶
func (cp *ColumnProperties) SetUnique(v bool) *ColumnProperties
type Constraint ¶
type Constraint interface {
IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
}
type CsvApi ¶
type CsvApi struct {
// contains filtered or unexported fields
}
func (*CsvApi) GetRowDriverFromRecord ¶
func (*CsvApi) SetRowDriverToRecord ¶
type DefaultConstraintDefinition ¶
type DefaultConstraintDefinition struct { // Schema - constraint schema name Schema string `json:"schema"` // Name - constraint name Name string `json:"name"` // Oid - Constraint oid in pg_constraint Oid Oid `json:"oid"` // Columns - columns involved into constraint Columns []AttNum `json:"columns,omitempty"` // Definition - real textual constraint definition Definition string `json:"definition,omitempty"` }
type Definition ¶
type Definition struct { Name string `json:"name"` Description string `json:"description"` Parameters []*Parameter `json:"parameters"` Validate bool `json:"validate"` ExpectedExitCode int `json:"expected_exit_code"` Driver *RowDriverParams `json:"driver"` New NewTransformerFunc `json:"-"` }
func NewDefinition ¶
func NewDefinition(name string, makeFunc NewTransformerFunc) *Definition
func (*Definition) AddParameter ¶
func (d *Definition) AddParameter(v *Parameter) *Definition
func (*Definition) SetDescription ¶
func (d *Definition) SetDescription(v string) *Definition
func (*Definition) SetExpectedExitCode ¶
func (d *Definition) SetExpectedExitCode(v int) *Definition
func (*Definition) SetMode ¶
func (d *Definition) SetMode(v *RowDriverParams) *Definition
func (*Definition) SetValidate ¶
func (d *Definition) SetValidate(v bool) *Definition
type Driver ¶
type Driver struct { Table *Table TypeMapPool []*pgtype.Map // ColumnMap - map column name to Column object ColumnMap map[string]*Column // AttrIdxMap - the number of attribute in tuple AttrIdxMap map[string]int // CustomTypes - list of custom types used in tables CustomTypes []*Type // contains filtered or unexported fields }
Driver - allows you to perform decoding operations from []bytes to go types and go types to bytes encoding operation TODO: Rename it to table Driver
func (*Driver) DecodeValueByColumnIdx ¶
func (*Driver) DecodeValueByColumnName ¶
func (*Driver) DecodeValueByTypeName ¶
func (*Driver) DecodeValueByTypeOid ¶
func (*Driver) EncodeValueByColumnIdx ¶
func (*Driver) EncodeValueByColumnName ¶
func (*Driver) EncodeValueByTypeName ¶
func (*Driver) EncodeValueByTypeOid ¶
func (*Driver) ScanValueByColumnIdx ¶
func (*Driver) ScanValueByColumnName ¶
func (*Driver) ScanValueByTypeName ¶
type Exclusion ¶
type Exclusion DefaultConstraintDefinition
func NewExclusion ¶
func (*Exclusion) IsAffected ¶
func (e *Exclusion) IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
type ForeignKey ¶
type ForeignKey struct { DefaultConstraintDefinition // ReferencedTable - table that has primary key definition on that discovering table is referencing ReferencedTable LinkedTable `json:"referencedTable,omitempty"` }
func NewForeignKey ¶
func NewForeignKey(schema, name, definition string, oid Oid, columns []AttNum, referencedTable LinkedTable) *ForeignKey
func (*ForeignKey) IsAffected ¶
func (fk *ForeignKey) IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
type InteractionApi ¶
type InteractionApi interface { // SetWriter - assign writer SetWriter(w io.Writer) // SetReader - assign reader SetReader(r io.Reader) // GetRowDriverFromRecord - get from toolkit.Record all the required attributes as a toolkit.RowDriver instance GetRowDriverFromRecord(r *Record) (RowDriver, error) // SetRowDriverToRecord - set transformed toolkit.RowDriver to the toolkit.Record SetRowDriverToRecord(rd RowDriver, r *Record) error // Encode - write encoded data with \n symbol in the end into io.Writer Encode(ctx context.Context, row RowDriver) error // Decode - read data with new line from io.Reader and encode to toolkit.RowDriver Decode(ctx context.Context) (RowDriver, error) // Clean - clean cached record Clean() }
InteractionApi - API for interaction with Cmd transformer. It must implement context cancellation, RW timeouts, encode-decode operations, extracting DTO and assigning received DTO to the toolkit.Record
func NewApi ¶
func NewApi(rowDriverParams *RowDriverParams, transferringColumns []int, affectedColumns []int, driver *Driver) (InteractionApi, error)
type JsonApi ¶
type JsonApi struct {
// contains filtered or unexported fields
}
func NewJsonApi ¶
func (*JsonApi) GetRowDriverFromRecord ¶
func (*JsonApi) SetRowDriverToRecord ¶
type LinkedTable ¶
type LinkedTable struct { // Schema - table schema name Schema string `json:"schema"` // Name - table name Name string `json:"name"` // Oid - table oid Oid Oid `json:"oid"` // Constraint - linked table constraint Constraint Constraint `json:"constraint,omitempty"` }
LinkedTable - table that involved into constraint, required for ForeignKey and PrimaryKeyReferences
type NewRowDriverFunc ¶
type NewRowDriverFunc func() RowDriver
type NewTransformerFunc ¶
type NewTransformerFunc func(ctx context.Context, driver *Driver, parameters map[string]*Parameter) ( Transformer, ValidationWarnings, error, )
type Parameter ¶
type Parameter struct { // Name - name of the parameter. Must be unique in the whole Transformer parameters slice Name string `mapstructure:"name" json:"name"` // Description - description of the parameter. Should contain the brief info about parameter Description string `mapstructure:"description" json:"description"` // Required - shows that parameter is required, and we expect we have to receive this value from config. // Event when DefaultValue is defined it will case error Required bool `mapstructure:"required" json:"required"` // IsColumn - shows is this parameter column related. If so ColumnProperties must be defined and assigned // otherwise it may cause an unhandled behaviour IsColumn bool `mapstructure:"is_column" json:"is_column"` // LinkParameter - link with parameter with provided name. This is required if performing raw value encoding // depends on the provided column type and/or relies on the database Driver LinkParameter string `mapstructure:"link_parameter" json:"link_parameter,omitempty"` // CastDbType - name of PostgreSQL type that would be used for Decoding raw value to the real go type. Is this // type does not exist will cause an error CastDbType string `mapstructure:"cast_db_type" json:"cast_db_type,omitempty"` // DefaultValue - default value of the parameter. Must be variable pointer and have the same type // as in ExpectedType DefaultValue ParamsValue `mapstructure:"default_value" json:"default_value,omitempty"` // ColumnProperties - detail info about expected column properties that may help to diagnose the table schema // and perform validation procedure Plays only with IsColumn ColumnProperties *ColumnProperties `mapstructure:"column_properties" json:"column_properties,omitempty"` // Unmarshaller - unmarshal function for the parameter raw data []byte. Using by default json.Unmarshal function Unmarshaller Unmarshaller `json:"-"` // RawValueValidator - raw value validator function that performs assertion and cause ValidationWarnings if it // has violations RawValueValidator RawValueValidator `json:"-"` // LinkedParameter - column-like parameter that has been linked during parsing procedure. Warning, do not // assign it manually, if you don't know the consequences LinkedColumnParameter *Parameter `json:"-"` // Column - column of the table that was assigned in the parsing procedure according to provided column name in // parameter value. In this case value has textual column name Column *Column `json:"-"` // ExpectedType - expected type of the provided variable during scanning procedure. It must be pointer on the // variable Driver *Driver `mapstructure:"-" json:"-"` // contains filtered or unexported fields }
Parameter - wide parameter entity definition that contains properties that allows to check schema, find affection, cast variable using some features and so on. It may be defined and assigned ot the Definition of the transformer if transformer has any parameters
func MustNewParameter ¶
func (*Parameter) Init ¶
func (p *Parameter) Init(driver *Driver, types []*Type, params []*Parameter, rawValue ParamsValue) (ValidationWarnings, error)
func (*Parameter) RawValue ¶
func (p *Parameter) RawValue() ParamsValue
func (*Parameter) SetCastDbType ¶
func (*Parameter) SetDefaultValue ¶
func (p *Parameter) SetDefaultValue(v ParamsValue) *Parameter
func (*Parameter) SetIsColumn ¶
func (p *Parameter) SetIsColumn(columnProperties *ColumnProperties) *Parameter
func (*Parameter) SetLinkParameter ¶
func (*Parameter) SetRawValueValidator ¶
func (p *Parameter) SetRawValueValidator(validator RawValueValidator) *Parameter
func (*Parameter) SetRequired ¶
func (*Parameter) SetUnmarshaller ¶
func (p *Parameter) SetUnmarshaller(unmarshaller Unmarshaller) *Parameter
type ParamsValue ¶
type ParamsValue []byte
func (*ParamsValue) UnmarshalJSON ¶
func (pv *ParamsValue) UnmarshalJSON(data []byte) error
type PrimaryKey ¶
type PrimaryKey struct { DefaultConstraintDefinition References []*LinkedTable }
func NewPrimaryKey ¶
func NewPrimaryKey(schema, name, definition string, oid Oid, columns []AttNum) *PrimaryKey
func (*PrimaryKey) IsAffected ¶
func (pk *PrimaryKey) IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
type RawRecordCsv ¶
type RawRecordCsv struct { Data []string // contains filtered or unexported fields }
func NewRawRecordCsv ¶
func NewRawRecordCsv(size int) *RawRecordCsv
func (*RawRecordCsv) Clean ¶
func (rr *RawRecordCsv) Clean()
func (*RawRecordCsv) Decode ¶
func (rr *RawRecordCsv) Decode(data []byte) (err error)
func (*RawRecordCsv) Encode ¶
func (rr *RawRecordCsv) Encode() ([]byte, error)
func (*RawRecordCsv) Length ¶
func (rr *RawRecordCsv) Length() int
type RawRecordStr ¶
type RawRecordStr map[int]*RawValueStr
RawRecordStr - record data transfer object for interaction with custom transformer via PIPE
func (*RawRecordStr) Clean ¶
func (rrs *RawRecordStr) Clean()
func (*RawRecordStr) Decode ¶
func (rrs *RawRecordStr) Decode(data []byte) error
func (*RawRecordStr) Encode ¶
func (rrs *RawRecordStr) Encode() ([]byte, error)
func (*RawRecordStr) Length ¶
func (rrs *RawRecordStr) Length() int
type RawRecordText ¶
type RawRecordText []byte
var DefaultNullSeq RawRecordText = []byte("\\N")
func NewRawRecordText ¶
func NewRawRecordText() *RawRecordText
func (*RawRecordText) Clean ¶
func (r *RawRecordText) Clean()
func (*RawRecordText) Decode ¶
func (r *RawRecordText) Decode(data []byte) error
func (*RawRecordText) Encode ¶
func (r *RawRecordText) Encode() ([]byte, error)
func (*RawRecordText) Length ¶
func (r *RawRecordText) Length() int
type RawValue ¶
func NewRawValue ¶
type RawValueStr ¶
func NewRawValueStr ¶
func NewRawValueStr(data []byte, isNull bool) *RawValueStr
type RawValueValidator ¶
type RawValueValidator func(p *Parameter, v ParamsValue) (ValidationWarnings, error)
type Record ¶
func (*Record) GetColumnValueByName ¶
func (*Record) GetRawColumnValueByIdx ¶
func (*Record) GetRawColumnValueByName ¶
func (*Record) ScanColumnValueByIdx ¶
ScanColumnValueByIdx - scan data from column with name into v and return isNull property and error
func (*Record) ScanColumnValueByName ¶
func (*Record) SetColumnValueByName ¶
SetColumnValueByName - set transformed attribute to the tuple
func (*Record) SetRawColumnValueByIdx ¶
func (*Record) SetRawColumnValueByName ¶
type RowDriver ¶
type RowDriver interface { // GetColumn - get raw []byte value by column idx GetColumn(idx int) (*RawValue, error) // SetColumn - set RawValue value by column idx to the current row SetColumn(idx int, v *RawValue) error // Encode - encode the whole row to the []byte representation of RowDriver. It would be CSV // line or JSON object, etc. Encode() ([]byte, error) // Decode - decode []bytes to RowDriver instance Decode([]byte) error // Length - count of attributes in the row Length() int // Clean - clean the state Clean() }
RowDriver - represents methods for interacts with any transferring format It might be COPY, CSV, JSON, etc. See implementation pgcopy.Row RowDriver must keep the current row state
type RowDriverParams ¶
type Table ¶
type Table struct { Schema string `json:"schema"` Name string `json:"name"` Oid Oid `json:"oid"` Columns []*Column `json:"columns"` Constraints []Constraint `json:"-"` }
type TextApi ¶
type TextApi struct {
// contains filtered or unexported fields
}
func (*TextApi) GetRowDriverFromRecord ¶
func (*TextApi) SetRowDriverToRecord ¶
type Trace ¶
type Trace struct { SchemaName string `json:"schemaName,omitempty"` TableName string `json:"tableName,omitempty"` TransformerName string `json:"transformerName,omitempty"` ParameterName string `json:"parameterName,omitempty"` Msg string `json:"msg,omitempty"` }
deprecated
type Transformer ¶
type TriggerConstraint ¶
type TriggerConstraint DefaultConstraintDefinition
func NewTriggerConstraint ¶
func NewTriggerConstraint(schema, name, definition string, oid Oid, columns []AttNum) *TriggerConstraint
func (*TriggerConstraint) IsAffected ¶
func (tc *TriggerConstraint) IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
type Type ¶
type Type struct { // Oid - pg_type.oid Oid Oid `json:"oid,omitempty"` // Chain - list of inherited types till the main base type Chain []Oid `json:"chain,omitempty"` // Schema - type schema name Schema string `json:"schema,omitempty"` // Name - (pg_type.typname) type name Name string `json:"name,omitempty"` // Length - (pg_type.typelen) for a fixed-size type, typlen is the number of bytes in the internal representation of the type. // But for a variable-length type, typlen is negative. -1 indicates a “varlena” type (one that has a length // word), -2 indicates a null-terminated C string. Length int `json:"length,omitempty"` // Kind - (pg_type.typtype) type of type Kind rune `json:"kind,omitempty"` // ComposedRelation - (pg_type.typrelid) if composite type reference to the table that defines the structure ComposedRelation Oid `json:"composed_relation,omitempty"` // ElementType - (pg_type.typelem) references to the item of the array type ElementType Oid `json:"element_type,omitempty"` // ArrayType - (pg_type.typarray) references to the array type ArrayType Oid `json:"array_type,omitempty"` // NotNull - (pg_type.typnotnull) shows is this type nullable. For domains only NotNull bool `json:"not_null,omitempty"` // BaseType - (pg_type.typbasetype) references to the base type BaseType Oid `json:"base_type,omitempty"` //Check - definition of check constraint Check *Check `json:"check,omitempty"` // RootBuiltInType - defines builtin type oid that might be used for decoding and encoding RootBuiltInType Oid `json:"root_built_in_type,omitempty"` }
Type - describes pg_catalog.pg_type
func (*Type) IsAffected ¶
func (t *Type) IsAffected(p *Parameter) (w ValidationWarnings)
type Unique ¶
type Unique DefaultConstraintDefinition
func (*Unique) IsAffected ¶
func (u *Unique) IsAffected(column *Column, columnProperties *ColumnProperties) (w ValidationWarnings)
type Unmarshaller ¶
type Unmarshaller func(parameter *Parameter, driver *Driver, src ParamsValue) (any, error)
type ValidationWarning ¶
type ValidationWarning struct { Msg string `json:"msg,omitempty"` Severity string `json:"severity,omitempty"` Trace *Trace `json:"trace,omitempty"` Meta map[string]any `json:"meta,omitempty"` Hash string `json:"hash"` }
func NewValidationWarning ¶
func NewValidationWarning() *ValidationWarning
func (*ValidationWarning) AddMeta ¶
func (re *ValidationWarning) AddMeta(key string, value any) *ValidationWarning
func (*ValidationWarning) MakeHash ¶
func (re *ValidationWarning) MakeHash()
func (*ValidationWarning) SetMsg ¶
func (re *ValidationWarning) SetMsg(msg string) *ValidationWarning
func (*ValidationWarning) SetMsgf ¶
func (re *ValidationWarning) SetMsgf(msg string, args ...any) *ValidationWarning
func (*ValidationWarning) SetSeverity ¶
func (re *ValidationWarning) SetSeverity(severity string) *ValidationWarning
func (*ValidationWarning) SetTrace ¶
func (re *ValidationWarning) SetTrace(value *Trace) *ValidationWarning
type ValidationWarnings ¶
type ValidationWarnings []*ValidationWarning
func InitParameters ¶
func InitParameters( driver *Driver, rawParams map[string]ParamsValue, paramDef []*Parameter, types []*Type, ) (map[string]*Parameter, ValidationWarnings, error)
func (ValidationWarnings) IsFatal ¶
func (re ValidationWarnings) IsFatal() bool
Source Files ¶
- cmd.go
- column.go
- common.go
- constraints.go
- csv_api.go
- definition.go
- driver.go
- interaction_api.go
- json_api.go
- meta.go
- parameter.go
- raw_record.go
- raw_record_csv.go
- raw_record_str.go
- raw_record_text.go
- record.go
- row_driver.go
- table.go
- text_api.go
- transformer.go
- types.go
- utils.go
- validation_warning.go
- values.go