datatypes

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gunzip added in v0.0.3

func Gunzip(data []byte) (resData []byte, err error)

Gunzip will unzip data and return buffer inline

Types

type ChangeEvent added in v0.0.3

type ChangeEvent[T any] struct {
	ID            string               `json:"id"`
	Timestamp     int64                `json:"timestamp"`
	MvccTimestamp string               `json:"mvccTimestamp"`
	Table         string               `json:"table"`
	Key           []string             `json:"key"`
	LocationID    *string              `json:"locationId,omitempty"`
	CompanyID     *string              `json:"companyId,omitempty"`
	UserID        *string              `json:"userId,omitempty"`
	SessionID     *string              `json:"sessionId,omitempty"`
	Version       int64                `json:"version"`
	Region        string               `json:"region"`
	Operation     ChangeEventOperation `json:"operation"`
	Before        *T                   `json:"before,omitempty"`
	After         *T                   `json:"after,omitempty"`
	Diff          []string             `json:"diff,omitempty"`
}

func (ChangeEvent[T]) GetAfter added in v0.0.3

func (c ChangeEvent[T]) GetAfter() any

func (ChangeEvent[T]) GetBefore added in v0.0.3

func (c ChangeEvent[T]) GetBefore() any

func (ChangeEvent[T]) GetOperation added in v0.0.3

func (c ChangeEvent[T]) GetOperation() ChangeEventOperation

func (ChangeEvent[T]) String added in v0.0.3

func (c ChangeEvent[T]) String() string

String returns a JSON stringified version of the ChangeEvent

type ChangeEventHelper added in v0.0.3

type ChangeEventHelper interface {
	GetOperation() ChangeEventOperation
	GetBefore() any
	GetAfter() any
}

type ChangeEventOperation added in v0.0.3

type ChangeEventOperation string
const (
	ChangeEventInsert ChangeEventOperation = "INSERT"
	ChangeEventUpdate ChangeEventOperation = "UPDATE"
	ChangeEventDelete ChangeEventOperation = "DELETE"
)

type DateTime added in v0.0.3

type DateTime time.Time

func (*DateTime) MarshalJSON added in v0.0.3

func (t *DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) UnmarshalJSON added in v0.0.3

func (t *DateTime) UnmarshalJSON(b []byte) error

type JSON

type JSON json.RawMessage

JSON defined JSON data type, need to implements driver.Valuer, sql.Scanner interface

func NewJSON

func NewJSON(kv map[string]interface{}) (JSON, error)

NewJSON returns a JSON structure from a map of key/value pairs

func NewJSONArray

func NewJSONArray() (JSON, error)

NewJSONArray returns an empty JSON array

func NewJSONObject

func NewJSONObject() (JSON, error)

NewJSONObject returns an empty JSON object

func (*JSON) Del

func (j *JSON) Del(key string) error

Del will delete the key in the JSON object

func (*JSON) Get

func (j *JSON) Get(key string) (interface{}, error)

Get will return the key value from the JSON object

func (JSON) GormDBDataType

func (JSON) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (JSON) GormDataType

func (JSON) GormDataType() string

GormDataType gorm common data type

func (JSON) GormValue

func (js JSON) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (*JSON) Has

func (j *JSON) Has(key string) bool

Has returns true if the key exists in the JSON object

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

MarshalJSON to output non base64 encoded []byte

func (*JSON) Scan

func (j *JSON) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*JSON) Set

func (j *JSON) Set(key string, val interface{}) error

Set will set the key and value in the JSON object

func (JSON) String

func (j JSON) String() string

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(b []byte) error

UnmarshalJSON to deserialize []byte

func (JSON) Value

func (j JSON) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type Meta

type Meta struct {
	UserID    *string `json:"userId,omitempty"`
	SessionID *string `json:"sessionId,omitempty"`
	Version   *int64  `json:"version,omitempty"`
}

func (Meta) GormDBDataType

func (Meta) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (*Meta) Scan

func (m *Meta) Scan(value interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*Meta) Value

func (m *Meta) Value() (driver.Value, error)

Value return Meta value, implement driver.Valuer interface

type NullableNumberArray

type NullableNumberArray []float64

func (NullableNumberArray) GormDBDataType

func (NullableNumberArray) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (*NullableNumberArray) Scan

func (arr *NullableNumberArray) Scan(value interface{}) error

func (NullableNumberArray) Value

func (arr NullableNumberArray) Value() (driver.Value, error)

type NullableStringArray

type NullableStringArray []string

func (NullableStringArray) GormDBDataType

func (NullableStringArray) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (*NullableStringArray) Scan

func (arr *NullableStringArray) Scan(value interface{}) error

func (NullableStringArray) Value

func (arr NullableStringArray) Value() (driver.Value, error)

type NumberArray

type NumberArray []float64

func (NumberArray) GormDBDataType

func (NumberArray) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (*NumberArray) Scan

func (arr *NumberArray) Scan(value interface{}) error

func (NumberArray) Value

func (arr NumberArray) Value() (driver.Value, error)

type StringArray

type StringArray []string

func (StringArray) GormDBDataType

func (StringArray) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (*StringArray) Scan

func (arr *StringArray) Scan(value interface{}) error

func (StringArray) Value

func (arr StringArray) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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