Documentation ¶
Index ¶
- Constants
- Variables
- func AlterTableAddColumn(transaction *DbTransaction, tableName, columnName, columnType string) error
- func AlterTableDropColumn(transaction *DbTransaction, tableName, columnName string) error
- func BatchInsert(rows []BatchModel, fields []string) error
- func CreateIndex(transaction *DbTransaction, indexName, tableName, onColumn string) error
- func CreateTable(transaction *DbTransaction, tableName, colsSQL string) error
- func DataTypeToColumnType(dataType string) string
- func DecrementTxAttemptCount(transactionHash []byte) error
- func DelExternalList(list []int64) error
- func Delete(transaction *DbTransaction, tblname, where string) error
- func DeleteLogTransactionsByHash(transaction *DbTransaction, hash []byte) (int64, error)
- func DeleteQueueTxByHash(transaction *DbTransaction, hash []byte) (int64, error)
- func DeleteTransactionByHash(hash []byte) (int64, error)
- func DeleteTransactionIfUnused(transaction *DbTransaction, transactionHash []byte) (int64, error)
- func DeleteUsedTransactions(transaction *DbTransaction) (int64, error)
- func DropDatabase(name string) error
- func DropTable(transaction *DbTransaction, tableName string) error
- func DropTables() error
- func ExecOBSSchema(id int, wallet int64) error
- func ExecSchema() error
- func ExecSchemaEcosystem(db *DbTransaction, id int, wallet int64, name string, founder, appID int64) error
- func GetAll(query string, countRows int, args ...interface{}) ([]map[string]string, error)
- func GetAllColumnTypes(tblname string) ([]map[string]string, error)
- func GetAllSystemStatesIDs() ([]int64, []string, error)
- func GetAllTransaction(transaction *DbTransaction, query string, countRows int, args ...interface{}) ([]map[string]string, error)
- func GetAllTransactions(limit int) (*[]Transaction, error)
- func GetAllTx(transaction *DbTransaction, query string, countRows int, args ...interface{}) ([]map[string]string, error)
- func GetAllUnsentTransactions() (*[]Transaction, error)
- func GetColumnByID(table, column, id string) (result string, err error)
- func GetColumnCount(tableName string) (int64, error)
- func GetColumnDataTypeCharMaxLength(tableName, columnName string) (map[string]string, error)
- func GetColumnType(tblname, column string) (itype string, err error)
- func GetDB(tr *DbTransaction) *gorm.DB
- func GetExcessCommonTokenMovementPerDay(tx *DbTransaction) (amount decimal.Decimal, err error)
- func GetKeysCount() (int64, error)
- func GetLogTransactionsCount(hash []byte) (int64, error)
- func GetMemberRoles(tx *DbTransaction, ecosys int64, account string) (roles []int64, err error)
- func GetMetricValues(metric, timeInterval, aggregateFunc, timeBlock string) ([]interface{}, error)
- func GetNextID(transaction *DbTransaction, table string) (int64, error)
- func GetQueuedTransactionsCount(hash []byte) (int64, error)
- func GetRecordsCountTx(db *DbTransaction, tableName, where string) (int64, error)
- func GetResult(rows *sql.Rows) ([]map[string]string, error)
- func GetRoleMembers(tx *DbTransaction, ecosys int64, roles []int64) (members []string, err error)
- func GetRowConditionsByTableNameAndID(transaction *DbTransaction, tblname string, id int64) (string, error)
- func GetRows(tableName, columns string, offset, limit int64) ([]map[string]string, error)
- func GetTableQuery(table string, ecosystemID int64) *gorm.DB
- func GetTransactionCountAll() (int64, error)
- func GetTransactionsCount(hash []byte) (int64, error)
- func GetTxCount() (int64, error)
- func GormClose() error
- func GormInit(host string, port int, user string, pass string, dbName string) error
- func HashExternalTx(id int64, hash []byte) error
- func IncExternalAttempt(id int64) error
- func IncrementTxAttemptCount(transactionHash []byte) (int64, error)
- func InitDB(cfg conf.DBConfig) error
- func IsIndex(tblname, column string) (bool, error)
- func IsTable(tblname string) bool
- func KeyTableName(prefix int64) string
- func MarkTransactionSent(transactionHash []byte) (int64, error)
- func MarkTransactionUnusedAndUnverified(transaction *DbTransaction, transactionHash []byte) (int64, error)
- func MarkTransactionUsed(transaction *DbTransaction, transactionHash []byte) (int64, error)
- func MarkVerifiedAndNotUsedTransactionsUnverified() (int64, error)
- func MemberHasRole(tx *DbTransaction, role, ecosys int64, account string) (bool, error)
- func NumIndexes(tblname string) (int, error)
- func SendTx(rtx RawTransaction, adminWallet int64) error
- func SetStopNow() error
- func UpdRollbackHash(transaction *DbTransaction, hash []byte) error
- func Update(transaction *DbTransaction, tblname, set, where string) error
- func UpdateSchema() error
- type APLSenderTxCount
- type APLTransfer
- type AppParam
- type BadBlocks
- type BanRequests
- type BatchModel
- type Binary
- type Block
- func (b *Block) Create(transaction *DbTransaction) error
- func (b *Block) DeleteById(transaction *DbTransaction, id int64) error
- func (b *Block) Get(blockID int64) (bool, error)
- func (b *Block) GetBlocks(startFromID int64, limit int32) ([]Block, error)
- func (b *Block) GetBlocksFrom(startFromID int64, ordering string, limit int32) ([]Block, error)
- func (b *Block) GetMaxBlock() (bool, error)
- func (b *Block) GetMaxForeignBlock(keyId int64) (bool, error)
- func (b *Block) GetNodeBlocksAtTime(from, to time.Time, node int64) ([]Block, error)
- func (b *Block) GetReverseBlockchain(endBlockID int64, limit int32) ([]Block, error)
- func (Block) TableName() string
- type BlockInterface
- type Confirmation
- type Contract
- func (c *Contract) Count() (count int64, err error)
- func (c *Contract) CountByEcosystem() (n int64, err error)
- func (c *Contract) GetByApp(appID int64, ecosystemID int64) ([]Contract, error)
- func (c *Contract) GetFromEcosystem(db *DbTransaction, ecosystem int64) ([]Contract, error)
- func (c *Contract) GetList(offset, limit int64) ([]Contract, error)
- func (c *Contract) GetListByEcosystem(offset, limit int64) ([]Contract, error)
- func (c *Contract) TableName() string
- func (c *Contract) ToMap() (v map[string]string)
- type Cron
- type DbTransaction
- type DelayedContract
- type Ecosystem
- type EcosystemTx
- type ExternalBlockchain
- type History
- type InfoBlock
- func (ib *InfoBlock) Create(transaction *DbTransaction) error
- func (ib *InfoBlock) Get() (bool, error)
- func (ib *InfoBlock) GetUnsent() (bool, error)
- func (ib *InfoBlock) MarkSent() error
- func (ib *InfoBlock) Marshall() []byte
- func (ib *InfoBlock) TableName() string
- func (ib *InfoBlock) Update(transaction *DbTransaction) error
- type Install
- type Key
- type KeyTableChecker
- type Language
- type ListResult
- type LogTransaction
- type Member
- type Menu
- type Metric
- type MigrationHistory
- type NextIDGetter
- type NodeBanLogs
- type Notification
- type NotificationsCount
- type OneRow
- type Page
- type Permissions
- type QueueBlock
- type QueueTx
- func (qt *QueueTx) Create() error
- func (qt *QueueTx) DeleteTx(transaction *DbTransaction) error
- func (qt QueueTx) FieldValue(fieldName string) (interface{}, error)
- func (qt *QueueTx) GetByHash(transaction *DbTransaction, hash []byte) (bool, error)
- func (qt *QueueTx) Save(transaction *DbTransaction) error
- func (qt *QueueTx) TableName() string
- type RawTransaction
- type Role
- type RolesParticipants
- type RollbackTx
- func (rt *RollbackTx) Create(transaction *DbTransaction) error
- func (rt *RollbackTx) DeleteByHash(dbTransaction *DbTransaction) error
- func (rt *RollbackTx) DeleteByHashAndTableName(transaction *DbTransaction) error
- func (rt *RollbackTx) Get(dbTransaction *DbTransaction, transactionHash []byte, tableName string) (bool, error)
- func (rt *RollbackTx) GetBlockRollbackTransactions(dbTransaction *DbTransaction, blockID int64) ([]RollbackTx, error)
- func (rt *RollbackTx) GetRollbackTransactions(dbTransaction *DbTransaction, transactionHash []byte) ([]map[string]string, error)
- func (rt *RollbackTx) GetRollbackTxsByTableIDAndTableName(tableID, tableName string, limit int) (*[]RollbackTx, error)
- func (RollbackTx) TableName() string
- type Signature
- type SingleResult
- type StateParameter
- type StopDaemon
- type SystemParameter
- func (sp *SystemParameter) Get(name string) (bool, error)
- func (sp *SystemParameter) GetJSONField(jsonField string, name string) (string, error)
- func (sp *SystemParameter) GetTransaction(transaction *DbTransaction, name string) (bool, error)
- func (sp *SystemParameter) GetValueParameterByName(name, value string) (*string, error)
- func (sp *SystemParameter) SaveArray(list [][]string) error
- func (sp SystemParameter) TableName() string
- func (sp *SystemParameter) ToMap() map[string]string
- func (sp SystemParameter) Update(value string) error
- type Table
- func (t *Table) Count() (count int64, err error)
- func (t *Table) Create(transaction *DbTransaction) error
- func (t *Table) Delete(transaction *DbTransaction) error
- func (t *Table) ExistsByName(transaction *DbTransaction, name string) (bool, error)
- func (t *Table) Get(transaction *DbTransaction, name string) (bool, error)
- func (t *Table) GetAll(prefix string) ([]Table, error)
- func (t *Table) GetColumns(transaction *DbTransaction, name, jsonKey string) (map[string]string, error)
- func (t *Table) GetPermissions(transaction *DbTransaction, name, jsonKey string) (map[string]string, error)
- func (t *Table) IsExistsByPermissionsAndTableName(transaction *DbTransaction, columnName, tableName string) (bool, error)
- func (t *Table) SetTablePrefix(prefix string)
- func (t *Table) TableName() string
- type Transaction
- type TransactionStatus
- func (ts *TransactionStatus) Create() error
- func (ts *TransactionStatus) Get(transactionHash []byte) (bool, error)
- func (ts *TransactionStatus) SetError(transaction *DbTransaction, errorText string, transactionHash []byte) error
- func (ts *TransactionStatus) TableName() string
- func (ts *TransactionStatus) UpdateBlockID(transaction *DbTransaction, newBlockID int64, transactionHash []byte) error
- func (ts *TransactionStatus) UpdateBlockMsg(transaction *DbTransaction, newBlockID int64, msg string, ...) error
- type TransactionsAttempts
Constants ¶
const ( NotificationTypeSingle = 1 NotificationTypeRole = 2 )
const ( // OrderASC as ASC OrderASC = ordering("ASC") // OrderDESC as DESC OrderDESC = ordering("DESC") )
const ( TransactionRateOnBlock transactionRate = iota + 1 TransactionRateStopNetwork )
This constants contains values of transactions priority
const BinaryTableSuffix = "_binaries"
const ProgressComplete = "complete"
ProgressComplete status of installation progress
Variables ¶
var ( // DBConn is orm connection DBConn *gorm.DB // ErrRecordNotFound is Not Found Record wrapper ErrRecordNotFound = gorm.ErrRecordNotFound // ErrDBConn database connection error ErrDBConn = errors.New("Database connection error") )
Functions ¶
func AlterTableAddColumn ¶
func AlterTableAddColumn(transaction *DbTransaction, tableName, columnName, columnType string) error
AlterTableAddColumn is adding column to table
func AlterTableDropColumn ¶
func AlterTableDropColumn(transaction *DbTransaction, tableName, columnName string) error
AlterTableDropColumn is dropping column from table
func BatchInsert ¶
func BatchInsert(rows []BatchModel, fields []string) error
BatchInsert create and execute batch queries from rows splitted by maxBatchRows and fields
func CreateIndex ¶
func CreateIndex(transaction *DbTransaction, indexName, tableName, onColumn string) error
CreateIndex is creating index on table column
func CreateTable ¶
func CreateTable(transaction *DbTransaction, tableName, colsSQL string) error
CreateTable is creating table
func DataTypeToColumnType ¶
func DecrementTxAttemptCount ¶
func Delete ¶
func Delete(transaction *DbTransaction, tblname, where string) error
Delete is deleting table rows
func DeleteLogTransactionsByHash ¶
func DeleteLogTransactionsByHash(transaction *DbTransaction, hash []byte) (int64, error)
DeleteLogTransactionsByHash is deleting record by hash
func DeleteQueueTxByHash ¶
func DeleteQueueTxByHash(transaction *DbTransaction, hash []byte) (int64, error)
DeleteQueueTxByHash is deleting queue tx by hash
func DeleteTransactionByHash ¶
DeleteTransactionByHash deleting transaction by hash
func DeleteTransactionIfUnused ¶
func DeleteTransactionIfUnused(transaction *DbTransaction, transactionHash []byte) (int64, error)
DeleteTransactionIfUnused deleting unused transaction
func DeleteUsedTransactions ¶
func DeleteUsedTransactions(transaction *DbTransaction) (int64, error)
DeleteUsedTransactions deleting used transaction
func DropDatabase ¶
DropDatabase kill all process and drop database
func DropTable ¶
func DropTable(transaction *DbTransaction, tableName string) error
DropTable is dropping table
func ExecOBSSchema ¶
ExecOBSSchema is executing schema for off blockchainService
func ExecSchemaEcosystem ¶
func ExecSchemaEcosystem(db *DbTransaction, id int, wallet int64, name string, founder, appID int64) error
ExecSchemaEcosystem is executing ecosystem schema
func GetAllColumnTypes ¶
GetAllColumnTypes returns column types for table
func GetAllSystemStatesIDs ¶
GetAllSystemStatesIDs is retrieving all ecosystems ids
func GetAllTransaction ¶
func GetAllTransaction(transaction *DbTransaction, query string, countRows int, args ...interface{}) ([]map[string]string, error)
GetAllTransaction is retrieve all query result rows
func GetAllTransactions ¶
func GetAllTransactions(limit int) (*[]Transaction, error)
GetAllTransactions is retrieving all transactions with limit
func GetAllTx ¶
func GetAllTx(transaction *DbTransaction, query string, countRows int, args ...interface{}) ([]map[string]string, error)
GetAllTx returns all tx's
func GetAllUnsentTransactions ¶
func GetAllUnsentTransactions() (*[]Transaction, error)
GetAllUnsentTransactions is retrieving all unset transactions
func GetColumnByID ¶
GetColumnByID returns the value of the column from the table by id
func GetColumnCount ¶
GetColumnCount is counting rows in table
func GetColumnDataTypeCharMaxLength ¶
GetColumnDataTypeCharMaxLength is returns max length of table column
func GetColumnType ¶
GetColumnType is returns type of column
func GetExcessCommonTokenMovementPerDay ¶
func GetExcessCommonTokenMovementPerDay(tx *DbTransaction) (amount decimal.Decimal, err error)
GetExcessCommonTokenMovementPerDay returns sum of amounts 24 hours
func GetLogTransactionsCount ¶
GetLogTransactionsCount count records by transaction hash
func GetMemberRoles ¶
func GetMemberRoles(tx *DbTransaction, ecosys int64, account string) (roles []int64, err error)
GetMemberRoles return map[id]name all roles assign to member in ecosystem
func GetMetricValues ¶
GetMetricValues returns aggregated metric values in the time interval
func GetNextID ¶
func GetNextID(transaction *DbTransaction, table string) (int64, error)
GetNextID returns next ID of table
func GetQueuedTransactionsCount ¶
GetQueuedTransactionsCount counting queued transactions
func GetRecordsCountTx ¶
func GetRecordsCountTx(db *DbTransaction, tableName, where string) (int64, error)
GetRecordsCountTx is counting all records of table in transaction
func GetRoleMembers ¶
func GetRoleMembers(tx *DbTransaction, ecosys int64, roles []int64) (members []string, err error)
GetRoleMembers return []id all members assign to roles in ecosystem
func GetRowConditionsByTableNameAndID ¶
func GetRowConditionsByTableNameAndID(transaction *DbTransaction, tblname string, id int64) (string, error)
GetRowConditionsByTableNameAndID returns value of `conditions` field for table row by id
func GetTransactionCountAll ¶
GetTransactionCountAll count all transactions
func GetTransactionsCount ¶
GetTransactionsCount count all transactions by hash
func GetTxCount ¶
func HashExternalTx ¶
func IncExternalAttempt ¶
func IncrementTxAttemptCount ¶
IncrementTxAttemptCount increases attempt column
func MarkTransactionSent ¶
MarkTransactionSent is marking transaction as sent
func MarkTransactionUnusedAndUnverified ¶
func MarkTransactionUnusedAndUnverified(transaction *DbTransaction, transactionHash []byte) (int64, error)
MarkTransactionUnusedAndUnverified is marking transaction unused and unverified
func MarkTransactionUsed ¶
func MarkTransactionUsed(transaction *DbTransaction, transactionHash []byte) (int64, error)
MarkTransactionUsed is marking transaction as used
func MarkVerifiedAndNotUsedTransactionsUnverified ¶
MarkVerifiedAndNotUsedTransactionsUnverified is marking verified and unused transaction as unverified
func MemberHasRole ¶
func MemberHasRole(tx *DbTransaction, role, ecosys int64, account string) (bool, error)
MemberHasRole returns true if member has role
func SendTx ¶
func SendTx(rtx RawTransaction, adminWallet int64) error
SendTx is creates transaction
func UpdRollbackHash ¶
func UpdRollbackHash(transaction *DbTransaction, hash []byte) error
UpdRollbackHash update model rollbacks_hash field
func Update ¶
func Update(transaction *DbTransaction, tblname, set, where string) error
Update is updating table rows
Types ¶
type APLSenderTxCount ¶
APLSenderTxCount struct to scan query result
func GetExcessTokenMovementQtyPerBlock ¶
func GetExcessTokenMovementQtyPerBlock(tx *DbTransaction, blockID int64) (excess []APLSenderTxCount, err error)
GetExcessTokenMovementQtyPerBlock returns from to pairs where APL transactions count greather than tokenMovementQtyPerBlockLimit per 24 hours
type APLTransfer ¶
APLTransfer from to amount
func GetExcessFromToTokenMovementPerDay ¶
func GetExcessFromToTokenMovementPerDay(tx *DbTransaction) (excess []APLTransfer, err error)
GetExcessFromToTokenMovementPerDay returns from to pairs where sum of amount greather than fromToPerDayLimit per 24 hours
type AppParam ¶
type AppParam struct { ID int64 `gorm:"primary_key;not null"` AppID int64 `gorm:"not null"` Name string `gorm:"not null;size:100"` Value string `gorm:"not null"` Conditions string `gorm:"not null"` // contains filtered or unexported fields }
AppParam is model
func (*AppParam) GetAllAppParameters ¶
GetAllAppParameters is returning all state parameters
func (*AppParam) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type BadBlocks ¶
type BadBlocks struct { ID int64 ProducerNodeId int64 BlockId int64 ConsumerNodeId int64 BlockTime time.Time Deleted bool }
func (*BadBlocks) GetNeedToBanNodes ¶
GetNeedToBanNodes is returns list of ban requests for each node
func (*BadBlocks) GetNodeBlocks ¶
type BanRequests ¶
BanRequests represents count of unique ban requests for node
type BatchModel ¶
BatchModel allows bulk insert on BatchModel slice
type Binary ¶
type Binary struct { ID int64 Name string Data []byte Hash string MimeType string // contains filtered or unexported fields }
Binary represents record of {prefix}_binaries table
func (*Binary) SetTableName ¶
SetTableName sets name of table
func (*Binary) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type Block ¶
type Block struct { ID int64 `gorm:"primary_key;not_null"` Hash []byte `gorm:"not null"` RollbacksHash []byte `gorm:"not null"` Data []byte `gorm:"not null"` EcosystemID int64 `gorm:"not null"` KeyID int64 `gorm:"not null"` NodePosition int64 `gorm:"not null"` Time int64 `gorm:"not null"` Tx int32 `gorm:"not null"` }
Block is model
func GetBlockchain ¶
GetBlockchain is retrieving chain of blocks from database
func (*Block) Create ¶
func (b *Block) Create(transaction *DbTransaction) error
Create is creating record of model
func (*Block) DeleteById ¶
func (b *Block) DeleteById(transaction *DbTransaction, id int64) error
DeleteById is deleting block by ID
func (*Block) GetBlocksFrom ¶
GetBlocksFrom is retrieving ordered chain of blocks from database
func (*Block) GetMaxBlock ¶
GetMaxBlock returns last block existence
func (*Block) GetMaxForeignBlock ¶
GetMaxForeignBlock returns last block generated not by key_id
func (*Block) GetNodeBlocksAtTime ¶
GetNodeBlocksAtTime returns records of blocks for time interval and position of node
func (*Block) GetReverseBlockchain ¶
GetReverseBlockchain returns records of blocks in reverse ordering
type BlockInterface ¶
type BlockInterface struct { ID int64 `gorm:"primary_key;not null" json:"id,omitempty"` Name string `gorm:"not null" json:"name,omitempty"` Value string `gorm:"not null" json:"value,omitempty"` Conditions string `gorm:"not null" json:"conditions,omitempty"` // contains filtered or unexported fields }
BlockInterface is model
func (*BlockInterface) Get ¶
func (bi *BlockInterface) Get(name string) (bool, error)
Get is retrieving model from database
func (*BlockInterface) GetByApp ¶
func (bi *BlockInterface) GetByApp(appID int64, ecosystemID int64) ([]BlockInterface, error)
GetByApp returns all interface blocks belonging to selected app
func (*BlockInterface) SetTablePrefix ¶
func (bi *BlockInterface) SetTablePrefix(prefix string)
SetTablePrefix is setting table prefix
func (BlockInterface) TableName ¶
func (bi BlockInterface) TableName() string
TableName returns name of table
type Confirmation ¶
type Confirmation struct { BlockID int64 `gorm:"primary_key"` Good int32 `gorm:"not null"` Bad int32 `gorm:"not null"` Time int32 `gorm:"not null"` }
Confirmation is model
func (*Confirmation) GetConfirmation ¶
func (c *Confirmation) GetConfirmation(blockID int64) (bool, error)
GetConfirmation returns if block with blockID exists
func (*Confirmation) GetGoodBlock ¶
func (c *Confirmation) GetGoodBlock(goodCount int) (bool, error)
GetGoodBlock returns last good block
type Contract ¶
type Contract struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` WalletID int64 `json:"wallet_id,omitempty"` Active bool `json:"active,omitempty"` TokenID int64 `json:"token_id,omitempty"` Conditions string `json:"conditions,omitempty"` AppID int64 `json:"app_id,omitempty"` EcosystemID int64 `gorm:"column:ecosystem" json:"ecosystem_id,omitempty"` // contains filtered or unexported fields }
Contract represents record of 1_contracts table
func (*Contract) CountByEcosystem ¶
func (*Contract) GetFromEcosystem ¶
func (c *Contract) GetFromEcosystem(db *DbTransaction, ecosystem int64) ([]Contract, error)
GetFromEcosystem retrieving ecosystem contracts from database
func (*Contract) GetListByEcosystem ¶
type Cron ¶
Cron represents record of {prefix}_cron table
func (*Cron) GetAllCronTasks ¶
GetAllCronTasks is returning all cron tasks
func (*Cron) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type DbTransaction ¶
type DbTransaction struct {
// contains filtered or unexported fields
}
DbTransaction is gorm.DB wrapper
func StartTransaction ¶
func StartTransaction() (*DbTransaction, error)
StartTransaction is beginning transaction
func (*DbTransaction) Connection ¶
func (tr *DbTransaction) Connection() *gorm.DB
Connection returns connection of database
func (*DbTransaction) ReleaseSavepoint ¶
func (tr *DbTransaction) ReleaseSavepoint(idTx int) error
ReleaseSavepoint releases PostgreSQL savepoint
func (*DbTransaction) Rollback ¶
func (tr *DbTransaction) Rollback()
Rollback is transaction rollback
func (*DbTransaction) RollbackSavepoint ¶
func (tr *DbTransaction) RollbackSavepoint(idTx int) error
RollbackSavepoint rollbacks PostgreSQL savepoint
func (*DbTransaction) Savepoint ¶
func (tr *DbTransaction) Savepoint(idTx int) error
Savepoint creates PostgreSQL savepoint
type DelayedContract ¶
type DelayedContract struct { ID int64 `gorm:"primary_key;not null"` Contract string `gorm:"not null"` KeyID int64 `gorm:"not null"` EveryBlock int64 `gorm:"not null"` BlockID int64 `gorm:"not null"` Counter int64 `gorm:"not null"` Limit int64 `gorm:"not null"` Delete bool `gorm:"not null"` Conditions string `gorm:"not null"` }
DelayedContract represents record of 1_delayed_contracts table
func GetAllDelayedContractsForBlockID ¶
func GetAllDelayedContractsForBlockID(blockID int64) ([]*DelayedContract, error)
GetAllDelayedContractsForBlockID returns contracts that want to execute for blockID
func (DelayedContract) TableName ¶
func (DelayedContract) TableName() string
TableName returns name of table
type Ecosystem ¶
Ecosystem is model
func (*Ecosystem) Delete ¶
func (sys *Ecosystem) Delete(transaction *DbTransaction) error
Delete is deleting record
type EcosystemTx ¶
EcosystemTx represents value of metric
func GetEcosystemTxPerDay ¶
func GetEcosystemTxPerDay(timeBlock int64) ([]*EcosystemTx, error)
GetEcosystemTxPerDay returns the count of transactions per day for ecosystems, processes data for two days
type ExternalBlockchain ¶
type ExternalBlockchain struct { Id int64 `gorm:"primary_key;not null"` Value string `gorm:"not null"` ExternalContract string `gorm:"not null"` ResultContract string `gorm:"not null"` Url string `gorm:"not null"` Uid string `gorm:"not null"` TxTime int64 `gorm:"not null"` Sent int64 `gorm:"not null"` Hash []byte `gorm:"not null"` Attempts int64 `gorm:"not null"` }
ExternalBlockchain represents a txinfo table
func GetExternalList ¶
func GetExternalList() (list []ExternalBlockchain, err error)
GetExternalList returns the list of network tx
type History ¶
type History struct { ID int64 SenderID int64 RecipientID int64 Amount decimal.Decimal Comment string BlockID int64 TxHash []byte `gorm:"column:txhash"` CreatedAt time.Time // contains filtered or unexported fields }
History represent record of history table
func (*History) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type InfoBlock ¶
type InfoBlock struct { Hash []byte `gorm:"not null"` EcosystemID int64 `gorm:"not null default 0"` KeyID int64 `gorm:"not null default 0"` NodePosition string `gorm:"not null default 0"` BlockID int64 `gorm:"not null"` Time int64 `gorm:"not null"` CurrentVersion string `gorm:"not null"` Sent int8 `gorm:"not null"` RollbacksHash []byte `gorm:"not null"` }
InfoBlock is model
func (*InfoBlock) Create ¶
func (ib *InfoBlock) Create(transaction *DbTransaction) error
Create is creating record of model
func (*InfoBlock) Update ¶
func (ib *InfoBlock) Update(transaction *DbTransaction) error
Update is update model
type Key ¶
type Key struct { ID int64 `gorm:"primary_key;not null" json:"id"` Ecosystem int64 `gorm:"column:ecosystem;not null" json:"ecosystem"` AccountID string `gorm:"column:account;not null" json:"account"` PublicKey []byte `gorm:"column:pub;not null" json:"pub"` Amount string `gorm:"not null" json:"amount"` Deposit string `gorm:"not null" json:"deposit"` Maxpay string `gorm:"not null" json:"maxpay"` Multi int64 `gorm:"not null" json:"multi"` Deleted int64 `gorm:"not null" json:"deleted"` Blocked int64 `gorm:"not null" json:"blocked"` // contains filtered or unexported fields }
Key is model
func (*Key) AccountKeyID ¶
func (*Key) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type KeyTableChecker ¶
type KeyTableChecker struct{}
func (KeyTableChecker) IsKeyTable ¶
func (ktc KeyTableChecker) IsKeyTable(tableName string) bool
type Language ¶
type Language struct { ID int64 `gorm:"primary_key;not null"` Name string `gorm:"not null;size:100"` Res string `gorm:"type:jsonb(PostgreSQL)"` Conditions string `gorm:"not null"` // contains filtered or unexported fields }
Language is model
func (*Language) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type ListResult ¶
type ListResult struct {
// contains filtered or unexported fields
}
ListResult is a structure for the list result
func GetList ¶
func GetList(query string, args ...interface{}) *ListResult
GetList returns the result of the query as ListResult variable
func (*ListResult) String ¶
func (r *ListResult) String() ([]string, error)
String return the slice of strings
type LogTransaction ¶
type LogTransaction struct { Hash []byte `gorm:"primary_key;not null"` Block int64 `gorm:"not null"` }
LogTransaction is model
func (*LogTransaction) Create ¶
func (lt *LogTransaction) Create(transaction *DbTransaction) error
Create is creating record of model
type Member ¶
type Member struct { ID int64 `gorm:"primary_key;not null"` MemberName string `gorm:"not null"` ImageID *int64 MemberInfo string `gorm:"type:jsonb(PostgreSQL)"` // contains filtered or unexported fields }
Member represents a ecosystem member
func (*Member) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type Menu ¶
type Menu struct { ID int64 `gorm:"primary_key;not null" json:"id"` Name string `gorm:"not null" json:"name"` Title string `gorm:"not null" json:"title"` Value string `gorm:"not null" json:"value"` Conditions string `gorm:"not null" json:"conditions"` // contains filtered or unexported fields }
Menu is model
func (*Menu) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type Metric ¶
type Metric struct { ID int64 `gorm:"primary_key;not null"` Time int64 `gorm:"not null"` Metric string `gorm:"not null"` Key string `gorm:"not null"` Value int64 `gorm:"not null"` }
Metric represents record of system_metrics table
type MigrationHistory ¶
type MigrationHistory struct { ID int64 `gorm:"primary_key;not null"` Version string `gorm:"not null"` DateApplied int64 `gorm:"not null"` }
MigrationHistory is model
func (*MigrationHistory) ApplyMigration ¶
func (mh *MigrationHistory) ApplyMigration(version, query string) error
ApplyMigration executes database schema and writes migration history
func (*MigrationHistory) CurrentVersion ¶
func (mh *MigrationHistory) CurrentVersion() (string, error)
CurrentVersion returns current version of database migrations
func (*MigrationHistory) TableName ¶
func (mh *MigrationHistory) TableName() string
TableName returns name of table
type NextIDGetter ¶
type NextIDGetter struct {
Tx *DbTransaction
}
type NodeBanLogs ¶
func (NodeBanLogs) TableName ¶
func (r NodeBanLogs) TableName() string
TableName returns name of table
type Notification ¶
type Notification struct { ID int64 `gorm:"primary_key;not null"` Recipient string `gorm:"type:jsonb(PostgreSQL)` Sender string `gorm:"type:jsonb(PostgreSQL)` Notification string `gorm:"type:jsonb(PostgreSQL)` PageParams string `gorm:"type:jsonb(PostgreSQL)` ProcessingInfo string `gorm:"type:jsonb(PostgreSQL)` PageName string `gorm:"size:255"` DateCreated int64 DateStartProcessing int64 DateClosed int64 Closed bool // contains filtered or unexported fields }
Notification structure
func (*Notification) SetTablePrefix ¶
func (n *Notification) SetTablePrefix(tablePrefix string)
SetTablePrefix set table Prefix
func (*Notification) TableName ¶
func (n *Notification) TableName() string
TableName returns table name
type NotificationsCount ¶
type NotificationsCount struct { RecipientID int64 `gorm:"recipient_id"` RoleID int64 `gorm:"role_id"` Count int64 `gorm:"count"` }
func GetNotificationsCount ¶
func GetNotificationsCount(ecosystemID int64, accounts []string) ([]NotificationsCount, error)
GetNotificationsCount returns all unclosed notifications by users and ecosystem through role_id if userIDs is nil or empty then filter will be skipped
type OneRow ¶
type OneRow struct {
// contains filtered or unexported fields
}
OneRow is storing one row result
func GetOneRowTransaction ¶
func GetOneRowTransaction(transaction *DbTransaction, query string, args ...interface{}) *OneRow
GetOneRowTransaction returns one row from transactions
type Page ¶
type Page struct { ID int64 `gorm:"primary_key;not null" json:"id,omitempty"` Name string `gorm:"not null" json:"name,omitempty"` Value string `gorm:"not null" json:"value,omitempty"` Menu string `gorm:"not null;size:255" json:"menu,omitempty"` ValidateCount int64 `gorm:"not null" json:"nodesCount,omitempty"` AppID int64 `gorm:"column:app_id;not null" json:"app_id,omitempty"` Conditions string `gorm:"not null" json:"conditions,omitempty"` // contains filtered or unexported fields }
Page is model
func (*Page) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type Permissions ¶
type Permissions struct { Insert string `json:"insert"` NewColumn string `json:"new_column"` Update string `json:"update"` Read string `json:"read"` Filter string `json:"filter"` }
func (*Permissions) Scan ¶
func (p *Permissions) Scan(v interface{}) error
type QueueBlock ¶
type QueueBlock struct { Hash []byte `gorm:"primary_key;not null"` BlockID int64 `gorm:"not null"` FullNodeID int64 `gorm:"not null"` }
QueueBlock is model
func (*QueueBlock) DeleteOldBlocks ¶
func (qb *QueueBlock) DeleteOldBlocks() error
DeleteOldBlocks is deleting old blocks
func (*QueueBlock) DeleteQueueBlockByHash ¶
func (qb *QueueBlock) DeleteQueueBlockByHash() error
DeleteQueueBlockByHash is deleting queue by hash
func (*QueueBlock) Get ¶
func (qb *QueueBlock) Get() (bool, error)
Get is retrieving model from database
func (*QueueBlock) GetQueueBlockByHash ¶
func (qb *QueueBlock) GetQueueBlockByHash(hash []byte) (bool, error)
GetQueueBlockByHash is retrieving blocks queue by hash
type QueueTx ¶
type QueueTx struct { Hash []byte `gorm:"primary_key;not null"` Data []byte `gorm:"not null"` FromGate int `gorm:"not null"` }
QueueTx is model
func GetAllUnverifiedAndUnusedTransactions ¶
GetAllUnverifiedAndUnusedTransactions is returns all unverified and unused transaction
func (*QueueTx) DeleteTx ¶
func (qt *QueueTx) DeleteTx(transaction *DbTransaction) error
DeleteTx is deleting tx
func (QueueTx) FieldValue ¶
FieldValue implementing BatchModel interface
func (*QueueTx) GetByHash ¶
func (qt *QueueTx) GetByHash(transaction *DbTransaction, hash []byte) (bool, error)
GetByHash is retrieving model from database by hash
func (*QueueTx) Save ¶
func (qt *QueueTx) Save(transaction *DbTransaction) error
Save is saving model
type RawTransaction ¶
type Role ¶
type Role struct { ID int64 `gorm:"primary_key;not null" json:"id"` DefaultPage string `gorm:"not null" json:"default_page"` RoleName string `gorm:"not null" json:"role_name"` Deleted int64 `gorm:"not null" json:"deleted"` RoleType int64 `gorm:"not null" json:"role_type"` // contains filtered or unexported fields }
Role is model
func (*Role) Get ¶
func (r *Role) Get(transaction *DbTransaction, id int64) (bool, error)
Get is retrieving model from database
func (*Role) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type RolesParticipants ¶
type RolesParticipants struct { Id int64 Role string `gorm:"type":jsonb(PostgreSQL)` Member string `gorm:"type":jsonb(PostgreSQL)` Appointed string `gorm:"type":jsonb(PostgreSQL)` DateCreated int64 DateDeleted int64 Deleted bool // contains filtered or unexported fields }
RolesParticipants represents record of {prefix}roles_participants table
func (*RolesParticipants) GetActiveMemberRoles ¶
func (r *RolesParticipants) GetActiveMemberRoles(account string) ([]RolesParticipants, error)
GetActiveMemberRoles returns active assigned roles for memberID
func (*RolesParticipants) SetTablePrefix ¶
func (r *RolesParticipants) SetTablePrefix(prefix int64) *RolesParticipants
SetTablePrefix is setting table prefix
func (RolesParticipants) TableName ¶
func (r RolesParticipants) TableName() string
TableName returns name of table
type RollbackTx ¶
type RollbackTx struct { ID int64 `gorm:"primary_key;not null" json:"-"` BlockID int64 `gorm:"not null" json:"block_id"` TxHash []byte `gorm:"not null" json:"tx_hash"` NameTable string `gorm:"not null;size:255;column:table_name" json:"table_name"` TableID string `gorm:"not null;size:255" json:"table_id"` Data string `gorm:"not null;type:jsonb(PostgreSQL)" json:"data"` }
RollbackTx is model
func (*RollbackTx) Create ¶
func (rt *RollbackTx) Create(transaction *DbTransaction) error
Create is creating record of model
func (*RollbackTx) DeleteByHash ¶
func (rt *RollbackTx) DeleteByHash(dbTransaction *DbTransaction) error
DeleteByHash is deleting rollbackTx by hash
func (*RollbackTx) DeleteByHashAndTableName ¶
func (rt *RollbackTx) DeleteByHashAndTableName(transaction *DbTransaction) error
DeleteByHashAndTableName is deleting tx by hash and table name
func (*RollbackTx) Get ¶
func (rt *RollbackTx) Get(dbTransaction *DbTransaction, transactionHash []byte, tableName string) (bool, error)
Get is retrieving model from database
func (*RollbackTx) GetBlockRollbackTransactions ¶
func (rt *RollbackTx) GetBlockRollbackTransactions(dbTransaction *DbTransaction, blockID int64) ([]RollbackTx, error)
GetBlockRollbackTransactions returns records of rollback by blockID
func (*RollbackTx) GetRollbackTransactions ¶
func (rt *RollbackTx) GetRollbackTransactions(dbTransaction *DbTransaction, transactionHash []byte) ([]map[string]string, error)
GetRollbackTransactions is returns rollback transactions
func (*RollbackTx) GetRollbackTxsByTableIDAndTableName ¶
func (rt *RollbackTx) GetRollbackTxsByTableIDAndTableName(tableID, tableName string, limit int) (*[]RollbackTx, error)
GetRollbackTxsByTableIDAndTableName returns records of rollback by table name and id
type Signature ¶
type Signature struct { Name string `gorm:"primary_key;not null;size:255"` Value string `gorm:"not null;type:jsonb(PostgreSQL)"` Conditions string `gorm:"not null"` // contains filtered or unexported fields }
Signature is model
func (*Signature) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type SingleResult ¶
type SingleResult struct {
// contains filtered or unexported fields
}
SingleResult is a structure for the single result
func Single ¶
func Single(transaction *DbTransaction, query string, args ...interface{}) *SingleResult
Single is retrieving single result
func (*SingleResult) Float64 ¶
func (r *SingleResult) Float64() (float64, error)
Float64 converts string to float64
func (*SingleResult) Int64 ¶
func (r *SingleResult) Int64() (int64, error)
Int64 converts bytes to int64
type StateParameter ¶
type StateParameter struct { ID int64 `gorm:"primary_key;not null"` Name string `gorm:"not null;size:100"` Value string `gorm:"not null"` Conditions string `gorm:"not null"` // contains filtered or unexported fields }
StateParameter is model
func (*StateParameter) Get ¶
func (sp *StateParameter) Get(transaction *DbTransaction, name string) (bool, error)
Get is retrieving model from database
func (*StateParameter) GetAllStateParameters ¶
func (sp *StateParameter) GetAllStateParameters() ([]StateParameter, error)
GetAllStateParameters is returning all state parameters
func (*StateParameter) SetTablePrefix ¶
func (sp *StateParameter) SetTablePrefix(prefix string)
SetTablePrefix is setting table prefix
func (*StateParameter) TableName ¶
func (sp *StateParameter) TableName() string
TableName returns name of table
type StopDaemon ¶
type StopDaemon struct {
StopTime int64 `gorm:"not null"`
}
StopDaemon is model
func (*StopDaemon) Get ¶
func (sd *StopDaemon) Get() (bool, error)
Get is retrieving model from database
func (*StopDaemon) TableName ¶
func (sd *StopDaemon) TableName() string
TableName returns name of table
type SystemParameter ¶
type SystemParameter struct { ID int64 `gorm:"primary_key;not null;"` Name string `gorm:"not null;size:255"` Value string `gorm:"not null"` Conditions string `gorm:"not null"` }
SystemParameter is model
func GetAllSystemParameters ¶
func GetAllSystemParameters(transaction *DbTransaction) ([]SystemParameter, error)
GetAllSystemParameters returns all system parameters
func (*SystemParameter) Get ¶
func (sp *SystemParameter) Get(name string) (bool, error)
Get is retrieving model from database
func (*SystemParameter) GetJSONField ¶
func (sp *SystemParameter) GetJSONField(jsonField string, name string) (string, error)
GetJSONField returns fields as json
func (*SystemParameter) GetTransaction ¶
func (sp *SystemParameter) GetTransaction(transaction *DbTransaction, name string) (bool, error)
GetTransaction is retrieving model from database using transaction
func (*SystemParameter) GetValueParameterByName ¶
func (sp *SystemParameter) GetValueParameterByName(name, value string) (*string, error)
GetValueParameterByName returns value parameter by name
func (*SystemParameter) SaveArray ¶
func (sp *SystemParameter) SaveArray(list [][]string) error
SaveArray is saving array
func (SystemParameter) TableName ¶
func (sp SystemParameter) TableName() string
TableName returns name of table
func (*SystemParameter) ToMap ¶
func (sp *SystemParameter) ToMap() map[string]string
ToMap is converting SystemParameter to map
func (SystemParameter) Update ¶
func (sp SystemParameter) Update(value string) error
Update is update model
type Table ¶
type Table struct { ID int64 `gorm:"primary_key;not null"` Name string `gorm:"not null;size:100"` Permissions Permissions `gorm:"not null;type:jsonb(PostgreSQL)"` Columns string `gorm:"not null"` Conditions string `gorm:"not null"` AppID int64 `gorm:"not null"` Ecosystem int64 `gorm:"not null"` }
Table is model
func (*Table) Create ¶
func (t *Table) Create(transaction *DbTransaction) error
Create is creating record of model
func (*Table) Delete ¶
func (t *Table) Delete(transaction *DbTransaction) error
Delete is deleting model from database
func (*Table) ExistsByName ¶
func (t *Table) ExistsByName(transaction *DbTransaction, name string) (bool, error)
ExistsByName finding table existence by name
func (*Table) Get ¶
func (t *Table) Get(transaction *DbTransaction, name string) (bool, error)
Get is retrieving model from database
func (*Table) GetColumns ¶
func (t *Table) GetColumns(transaction *DbTransaction, name, jsonKey string) (map[string]string, error)
GetColumns returns columns from database
func (*Table) GetPermissions ¶
func (t *Table) GetPermissions(transaction *DbTransaction, name, jsonKey string) (map[string]string, error)
GetPermissions returns table permissions by name
func (*Table) IsExistsByPermissionsAndTableName ¶
func (t *Table) IsExistsByPermissionsAndTableName(transaction *DbTransaction, columnName, tableName string) (bool, error)
IsExistsByPermissionsAndTableName returns columns existence by permission and table name
func (*Table) SetTablePrefix ¶
SetTablePrefix is setting table prefix
type Transaction ¶
type Transaction struct { Hash []byte `gorm:"private_key;not null"` Data []byte `gorm:"not null"` Used int8 `gorm:"not null"` HighRate transactionRate `gorm:"not null"` Type int8 `gorm:"not null"` KeyID int64 `gorm:"not null"` Sent int8 `gorm:"not null"` Verified int8 `gorm:"not null;default:1"` }
Transaction is model
func GetAllUnusedTransactions ¶
func GetAllUnusedTransactions(limit int) ([]*Transaction, error)
GetAllUnusedTransactions is retrieving all unused transactions
func GetManyTransactions ¶
func GetManyTransactions(dbtx *DbTransaction, hashes [][]byte) ([]Transaction, error)
func (*Transaction) Create ¶
func (t *Transaction) Create() error
Create is creating record of model
func (*Transaction) Get ¶
func (t *Transaction) Get(transactionHash []byte) (bool, error)
Get is retrieving model from database
func (*Transaction) GetVerified ¶
func (t *Transaction) GetVerified(transactionHash []byte) (bool, error)
GetVerified is checking transaction verification by hash
type TransactionStatus ¶
type TransactionStatus struct { Hash []byte `gorm:"primary_key;not null"` Time int64 `gorm:"not null;"` Type int64 `gorm:"not null"` WalletID int64 `gorm:"not null"` BlockID int64 `gorm:"not null"` Error string `gorm:"not null;size 255"` }
TransactionStatus is model
func (*TransactionStatus) Create ¶
func (ts *TransactionStatus) Create() error
Create is creating record of model
func (*TransactionStatus) Get ¶
func (ts *TransactionStatus) Get(transactionHash []byte) (bool, error)
Get is retrieving model from database
func (*TransactionStatus) SetError ¶
func (ts *TransactionStatus) SetError(transaction *DbTransaction, errorText string, transactionHash []byte) error
SetError is updating transaction status error
func (*TransactionStatus) TableName ¶
func (ts *TransactionStatus) TableName() string
TableName returns name of table
func (*TransactionStatus) UpdateBlockID ¶
func (ts *TransactionStatus) UpdateBlockID(transaction *DbTransaction, newBlockID int64, transactionHash []byte) error
UpdateBlockID is updating block id
func (*TransactionStatus) UpdateBlockMsg ¶
func (ts *TransactionStatus) UpdateBlockMsg(transaction *DbTransaction, newBlockID int64, msg string, transactionHash []byte) error
UpdateBlockMsg is updating block msg
type TransactionsAttempts ¶
type TransactionsAttempts struct { Hash []byte `gorm:"primary_key;not null"` Attempt int8 `gorm:"not null"` }
TransactionsAttempts is model
func (*TransactionsAttempts) GetByHash ¶
func (ta *TransactionsAttempts) GetByHash() (bool, error)
GetByHash returns TransactionsAttempts existence by hash
Source Files ¶
- app_param.go
- bad_blocks.go
- batch.go
- binary.go
- blockchain.go
- blockinterface.go
- confirmations.go
- contract.go
- cron.go
- db.go
- delayed_contract.go
- external_blockchain.go
- history.go
- info_block.go
- install.go
- keys.go
- language.go
- log_transaction.go
- members.go
- menu.go
- metric.go
- migration_history.go
- node_ban_logs.go
- notification.go
- ordering.go
- pages.go
- queue_block.go
- queue_tx.go
- result.go
- role.go
- roles_participants.go
- rollback_tx.go
- signatures.go
- state_parameters.go
- stop_daemons.go
- system_parameters.go
- system_states.go
- tables.go
- transaction.go
- transaction_status.go
- transactions_attempts.go
- upd_full_nodes.go