Documentation ¶
Index ¶
Constants ¶
View Source
const ( MediaUploadEnabled = 1 // enabled MediaUploadDisabled = 2 // deleted )
View Source
const ( TRANSACTION_STATUS_PENDING = 1 TRANSACTION_STATUS_DONE = 2 TRANSACTION_STATUS_ERROR = 3 TRANSACTION_STATUS_PENDING_CB = 4 )
View Source
const ( TRANSACTION_KIND_NFT = 1 TRANSACTION_KIND_TOKEN = 2 )
Variables ¶
View Source
var ( // Db is the global database reference Db *gorm.DB )
Functions ¶
func DropAllTables ¶
func DropAllTables()
DropAllTables drops all tables and relations, only works with local database in debug mode
func InitializeDatabase ¶
func InitializeDatabase()
InitializeDatabase opens and migrates the database if necessary
Types ¶
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface
func (JSONMap) GormDBDataType ¶
GormDBDataType gorm db data type
func (JSONMap) GormDataType ¶
GormDataType gorm common data type
func (JSONMap) MarshalJSON ¶
MarshalJSON to output non base64 encoded []byte
func (*JSONMap) UnmarshalJSON ¶
UnmarshalJSON to deserialize []byte
type MediaUpload ¶
type Object ¶
type Object struct { gorm.Model Cid string `gorm:"column:cid; index" binding:"required"` OwnerUid string `gorm:"column:owner_uid; index" binding:"required"` OwnerProvider string `gorm:"column:owner_provider; index" binding:"required"` Name string `gorm:"column:name; index" binding:"required"` Description string `gorm:"description; index"` CoverImageUri string `gorm:"coverImageUri"` CreatedAtInner time.Time `gorm:"column:created_at_inner"` Body JSONMap `gorm:"column:body"` Files JSONMap `gorm:"column:files"` }
type PinnedArc ¶
type PinnedArc struct { gorm.Model Object Arc Arc `gorm:"foreignkey:ArcId; references: id; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` ArcId uint `gorm:"column:arc_id; index"` Pin Pin `gorm:"foreignkey:PinId; references: id; constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` PinId uint `gorm:"column:pin_id; index"` }
type Place ¶
type Place struct { gorm.Model Name string `gorm:"column:name; binding:"required"` Location PointGeo `gorm:"column:location"` ViewportNE PointGeo `gorm:"column:viewport_ne"` ViewportSW PointGeo `gorm:"column:viewport_sw"` Uid string `gorm:"column:uid; binding:"required"` Status byte `gorm:"column:status; index"` Metadata string `gorm:"column:metadata; binding:"required"` }
func (*Place) MarshallFromJson ¶
MarshallFromJson marshalls Place to PlaceJson
func (*Place) MarshallToJson ¶
MarshallToJson marshalls Place to PlaceJson
type PlaceJson ¶
type PlaceJson struct { Name string `json:"name"` Geometry struct { Location struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` } `json:"location"` Viewport struct { Northeast struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` } `json:"northeast,omitempty"` Southwest struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` } `json:"southwest,omitempty"` } `json:"viewport,omitempty"` } `json:"geometry,omitempty"` Metadata string `json:"metadata,omitempty"` Uid string `json:"uid,omitempty"` CreatedAt string `json:"createdAt,omitempty"` }
type PointGeo ¶
PointGeo is a manually serialized postgis point
func (*PointGeo) GormDataType ¶
GormDataType sets the Gorm type to geometry
type Transaction ¶
type Transaction struct { gorm.Model Uid string `gorm:"column:uid; index" binding:"required"` Kind string `gorm:"column:kind" binding:"required"` Status byte `gorm:"column:status" binding:"required"` WalletAddr string `json:"column:wallet_addr" binding:"required"` WalletKind string `json:"column:wallet_kind" binding:"required"` CallbackUri string `json:"column:callback_uri" binding:"required"` IpfsCid string `json:"column:ipfs_cid"` TokenQuantity int `json:"column:token_quantity"` Metadata JSONMap `gorm:"column:metadata"` Cost string `json:"column:cost"` ContractAddr string `json:"column:contract_addr"` ErrorCount int `json:"column:error_count"` LastErrorAt time.Time `json:"column:last_error_at"` LastError string `json:"column:last_error"` }
Click to show internal directories.
Click to hide internal directories.