datatypes

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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