jsonb

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 4 Imported by: 0

README

golang-postgres-jsonb

this library is a helper for processing type jsonb postgresql

how to use:

-first, you have execute to query from postgres -then, you need to specify struct

example

type SomeStruct struct { ID int64 json:"id" db:"id" Metadata jsonb.JSONB json:"metadata" db:"metadata" }

-after that, you have to struct scan from query fetch -then, you can check function: GetValue: if you want to get stringify jsonb IsValid: if you want to check if jsonb type is valid IsNull: check if jsonb is null UnmarshalJSONB: if you want to unmarshal jsonb MarshalJSONB: if you want to marshal jsonb

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONB

type JSONB []byte

func (JSONB) GetValue

func (j JSONB) GetValue() (driver.Value, error)

GetValue is a func to get value of jsonb

func (JSONB) IsNull

func (j JSONB) IsNull() bool

IsNull check if jsonb is null

func (JSONB) IsValid

func (j JSONB) IsValid(value interface{}) bool

IsValid check if jsonb is valid format

func (JSONB) MarshalJSONB

func (j JSONB) MarshalJSONB() ([]byte, error)

MarshalJSONB is a func returns JSONB encoding of m.

func (*JSONB) Scan

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

Scan is a func to scan jsonb from interface

func (*JSONB) UnmarshalJSONB

func (j *JSONB) UnmarshalJSONB(data []byte) (string, error)

UnmarshalJSONB is a func return jsonb unmarshal as string

Jump to

Keyboard shortcuts

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