model

package
v0.0.0-...-d804a77 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DuplicateKeyErr = errors.New("record is exists")

Functions

This section is empty.

Types

type Objects

type Objects struct {
	ObjectId            string         `gorm:"primaryKey;not null;size:42;unique" json:"objectId"`
	Version             int64          `gorm:"type:bigint;not null;" json:"version"`
	Digest              string         `gorm:"not null;size:44;" json:"digest"`
	Owner               datatypes.JSON `gorm:"type:jsonb;" json:"owner"`
	PreviousTransaction string         `gorm:"size:44" json:"previousTransaction"`
	StorageRebate       int64          `gorm:"type:bigint" json:"storageRebate"`
	Status              string         `gorm:"size:10" json:"status"`
	DataType            string         `gorm:"size:255" json:"dataType"`
	Type                string         `gorm:"type:text;" json:"type"`
	HasPublicTransfer   bool           `gorm:"type:bool;" json:"hasPublicTransfer"`
	Fields              datatypes.JSON `gorm:"type:jsonb;" json:"fields"`
	CreateTime          time.Time      `gorm:"type:timestamp;not null;default:now()" json:"createTime"`
	UpdateTime          time.Time      `gorm:"type:timestamp;not null;default:now()" json:"updateTime"`
	IsUpdate            bool           `gorm:"type:bool;not null;default:false" json:"isUpdate"`
}

func (Objects) TableName

func (o Objects) TableName() string

type QueueMessage

type QueueMessage struct {
	Id              int64          `gorm:"type:bigint;primaryKey;autoIncrement" json:"id"`
	Message         datatypes.JSON `gorm:"type:jsonb;" json:"message"`
	GroupId         string         `gorm:"size:100" json:"groupId"`
	Topic           string         `gorm:"size:100;not null" json:"topic"`
	Key             string         `gorm:"size:255;" json:"key"`
	Status          string         `gorm:"size:10;not null" json:"status"`
	ManualProcess   bool           `gorm:"type:bool;not null;default:false" json:"manualProcess"`
	ErrReason       string         `gorm:"type:text;" json:"errReason"`
	CreateTime      time.Time      `gorm:"type:timestamp;not null;default:now()" json:"createTime"`
	UpdateTime      time.Time      `gorm:"type:timestamp;not null;default:now()" json:"updateTime"`
	AutoCustomCount int            `gorm:"type:int;not null;default:1" json:"autoCustomCount"`
}

func (QueueMessage) TableName

func (q QueueMessage) TableName() string

type SuiDB

type SuiDB struct {
	*gorm.DB
}

func NewSuiDB

func NewSuiDB(c config.DBConfig) (*SuiDB, error)

func (*SuiDB) ClearData

func (s *SuiDB) ClearData() error

func (*SuiDB) ClearPackageData

func (s *SuiDB) ClearPackageData() error

func (*SuiDB) CreateObject

func (s *SuiDB) CreateObject(tableName string, object Objects) (*Objects, error)

func (*SuiDB) CreateQueueMessages

func (s *SuiDB) CreateQueueMessages(list []QueueMessage) bool

func (*SuiDB) CreateTransactions

func (s *SuiDB) CreateTransactions(transactions *TransactionList) (*TransactionList, error)

func (*SuiDB) DeleteObjects

func (s *SuiDB) DeleteObjects(tableName string, objectIds string)

func (*SuiDB) GetDigestUnknownTransaction

func (s *SuiDB) GetDigestUnknownTransaction(size int) []*TransactionList

func (*SuiDB) GetLastTransactionDigest

func (s *SuiDB) GetLastTransactionDigest() string

func (*SuiDB) GetLeaveOverNeedUpdateObjects

func (s *SuiDB) GetLeaveOverNeedUpdateObjects(tableName string, from time.Time, limit, offerSet int) []*Objects

func (*SuiDB) GetNeedUpdateObjects

func (s *SuiDB) GetNeedUpdateObjects(tableName string, objects []*Objects) (result []*Objects)

func (*SuiDB) GetObjectByIds

func (s *SuiDB) GetObjectByIds(tableName string, objectIds ...string) ([]*Objects, error)

func (*SuiDB) GetQueueMessage

func (s *SuiDB) GetQueueMessage(size int) []*QueueMessage

func (*SuiDB) GetRelayMsg

func (s *SuiDB) GetRelayMsg(objectType, relayObjectId, relayPoster string, errText []string) bool

func (*SuiDB) GetTransactions

func (s *SuiDB) GetTransactions(transactions []TransactionList) (result []*TransactionList)

func (*SuiDB) InsertStartTransaction

func (s *SuiDB) InsertStartTransaction(number int64) error

func (*SuiDB) Migrate

func (s *SuiDB) Migrate() error

func (*SuiDB) UpdateObjectToNeedUpdate

func (s *SuiDB) UpdateObjectToNeedUpdate(tableName string, object Objects) (*Objects, error)

func (*SuiDB) UpdateObjects

func (s *SuiDB) UpdateObjects(tableName string, object Objects) bool

func (*SuiDB) UpdateQueueMessage

func (s *SuiDB) UpdateQueueMessage(message *QueueMessage)

func (*SuiDB) UpdateTransaction

func (s *SuiDB) UpdateTransaction(transaction TransactionList) bool

type TransactionList

type TransactionList struct {
	Number            int64     `gorm:"primaryKey;type:bigint;not null;uniqueIndex;autoincrement" json:"number"`
	TransactionDigest string    `gorm:"size:44;not null;uniqueIndex" json:"transactionDigest"`
	IsAnalyze         bool      `gorm:"type:bool;not null" json:"isAnalyze"`
	CreateTime        time.Time `gorm:"type:timestamp;not null;default:now()" json:"createTime"`
	TimestampMs       int64     `gorm:"type:bigint" json:"timestampMs"`
	UpdateTime        time.Time `gorm:"type:timestamp;not null;default:now()" json:"updateTime"`
}

func (TransactionList) TableName

func (t TransactionList) TableName() string

Jump to

Keyboard shortcuts

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