json_datatypes

package
v0.0.0-...-841f565 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetermineDBDataType

func DetermineDBDataType(db *gorm.DB) string

DetermineDBDataType determines the underlying database type implemented by gorm

func MarshalString

func MarshalString(m interface{}) (driver.Value, error)

MarshalString takes in an interface and marshals it to json and returns it as a Value interface

func Scan

func Scan(val interface{}, dest interface{}) error

Scan takes in an interface determines it's type and unmarshalls it to a destination interface

Types

type MapStringInterface

type MapStringInterface map[string]interface{}

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

func (MapStringInterface) GormDBDataType

func (MapStringInterface) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType gorm db data type

func (MapStringInterface) GormDataType

func (m MapStringInterface) GormDataType() string

GormDataType gorm common data type

func (*MapStringInterface) Scan

func (m *MapStringInterface) Scan(val interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (MapStringInterface) Value

func (m MapStringInterface) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type StringSlice

type StringSlice []string

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

func (StringSlice) GormDBDataType

func (StringSlice) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType gorm db data type

func (StringSlice) GormDataType

func (m StringSlice) GormDataType() string

GormDataType gorm common data type

func (*StringSlice) Scan

func (m *StringSlice) Scan(val interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (StringSlice) Value

func (m StringSlice) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

Jump to

Keyboard shortcuts

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