model

package
v0.0.0-...-b8f9f05 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ProgressComplete = "complete"

Variables

View Source
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(tableName, columnName string) error

AlterTableDropColumn is dropping column from table

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 CreateVDETable

func CreateVDETable(transaction *DbTransaction, tableName, colsSQL string) error

CreateVDETable is creating VDE table

func Delete

func Delete(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 DeleteLoopedTransactions

func DeleteLoopedTransactions() (int64, error)

DeleteLoopedTransactions deleting lopped transactions

func DeleteQueueTxByHash

func DeleteQueueTxByHash(transaction *DbTransaction, hash []byte) (int64, error)

DeleteQueueTxByHash is deleting queue tx by hash

func DeleteTransactionByHash

func DeleteTransactionByHash(hash []byte) (int64, error)

DeleteTransactionByHash deleting transaction by hash

func DeleteTransactionIfUnused

func DeleteTransactionIfUnused(transactionHash []byte) (int64, error)

DeleteTransactionIfUnused deleting unused transaction

func DeleteUsedTransactions

func DeleteUsedTransactions(transaction *DbTransaction) (int64, error)

DeleteUsedTransactions deleting used transaction

func DropTable

func DropTable(transaction *DbTransaction, tableName string) error

DropTable is dropping table

func DropTables

func DropTables() error

DropTables is dropping all of the tables

func ExecSchema

func ExecSchema() error

ExecSchema is executing schema

func ExecSchemaEcosystem

func ExecSchemaEcosystem(db *DbTransaction, id int, wallet int64, name string, founder int64) error

ExecSchemaEcosystem is executing ecosystem schema

func ExecSchemaLocalData

func ExecSchemaLocalData(id int, wallet int64) error

ExecSchemaLocalData is executing schema with local data

func GetAll

func GetAll(query string, countRows int, args ...interface{}) ([]map[string]string, error)

GetAll returns all transaction

func GetAllNotifications

func GetAllNotifications(ecosystemID int64, lastNotificationID int64, userIDs []int64) ([]map[string]string, error)

GetAllNotifications is retrieving all notifications by params

func GetAllSystemStatesIDs

func GetAllSystemStatesIDs() ([]int64, error)

GetAllSystemStatesIDs is retrieving all system states 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

func GetColumnByID(table, column, id string) (result string, err error)

GetColumnByID returns the value of the column from the table by id

func GetColumnCount

func GetColumnCount(tableName string) (int64, error)

GetColumnCount is counting rows in table

func GetColumnDataTypeCharMaxLength

func GetColumnDataTypeCharMaxLength(tableName, columnName string) (map[string]string, error)

GetColumnDataTypeCharMaxLength is returns max length of table column

func GetColumnType

func GetColumnType(tblname, column string) (itype string, err error)

GetColumnType is returns type of column

func GetDB

func GetDB(tr *DbTransaction) *gorm.DB

GetDB is returning gorm.DB

func GetLogTransactionsCount

func GetLogTransactionsCount(hash []byte) (int64, error)

GetLogTransactionsCount count records by transaction hash

func GetNextID

func GetNextID(transaction *DbTransaction, table string) (int64, error)

GetNextID returns next ID of table

func GetQueuedTransactionsCount

func GetQueuedTransactionsCount(hash []byte) (int64, error)

GetQueuedTransactionsCount counting queued transactions

func GetRecordsCountTx

func GetRecordsCountTx(db *DbTransaction, tableName string) (int64, error)

GetRecordsCount is counting all records of table in transaction

func GetRowConditionsByTableNameAndID

func GetRowConditionsByTableNameAndID(tblname string, id int64) (string, error)

GetRowConditionsByTableNameAndID returns value of `conditions` field for table row by id

func GetTransactionCountAll

func GetTransactionCountAll() (int64, error)

GetTransactionCountAll count all transactions

func GetTransactionsCount

func GetTransactionsCount(hash []byte) (int64, error)

GetTransactionsCount count all transactions by hash

func GormClose

func GormClose() error

GormClose is closing Gorm connection

func GormInit

func GormInit(host string, port int, user string, pass string, dbName string) error

GormInit is initializes Gorm connection

func InitDB

func InitDB(cfg conf.DBConfig) error

InitDB drop all tables and exec db schema

func IsIndex

func IsIndex(tblname, column string) (bool, error)

IsIndex returns is table column is an index

func IsNodeState

func IsNodeState(state int64, host string) bool

IsNodeState :Because of import cycle utils and config

func IsTable

func IsTable(tblname string) bool

IsTable returns is table exists

func MarkTransactionSent

func MarkTransactionSent(transactionHash []byte) (int64, error)

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

func MarkVerifiedAndNotUsedTransactionsUnverified() (int64, error)

MarkVerifiedAndNotUsedTransactionsUnverified is marking verified and unused transaction as unverified

func NumIndexes

func NumIndexes(tblname string) (int, error)

NumIndexes is counting table indexes

func SendTx

func SendTx(txType int64, adminWallet int64, data []byte) ([]byte, error)

SendTx is creates transaction

func SetStopNow

func SetStopNow() error

SetStopNow is updating daemon stopping time to now

func Update

func Update(transaction *DbTransaction, tblname, set, where string) error

Update is updating table rows

Types

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

func GetBlockchain(startBlockID int64, endblockID int64) ([]Block, error)

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) Get

func (b *Block) Get(blockID int64) (bool, error)

Get is retrieving model from database

func (*Block) GetBlocks

func (b *Block) GetBlocks(startFromID int64, limit int32) ([]Block, error)

GetBlocks is retrieving limited chain of blocks from database

func (*Block) GetBlocksFrom

func (b *Block) GetBlocksFrom(startFromID int64, ordering string) ([]Block, error)

GetBlocksFrom is retrieving ordered chain of blocks from database

func (*Block) GetMaxBlock

func (b *Block) GetMaxBlock() (bool, error)

GetMaxBlock returns last block existence

func (Block) TableName

func (Block) 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

func (*Confirmation) Save

func (c *Confirmation) Save() error

Save is saving model

type Cron

type Cron struct {
	ID       int64
	Cron     string
	Contract string
	// contains filtered or unexported fields
}

func (*Cron) Get

func (c *Cron) Get(id int64) (bool, error)

Get is retrieving model from database

func (*Cron) GetAllCronTasks

func (c *Cron) GetAllCronTasks() ([]*Cron, error)

GetAllCronTasks is returning all cron tasks

func (*Cron) SetTablePrefix

func (c *Cron) SetTablePrefix(prefix string)

SetTablePrefix is setting table prefix

func (*Cron) TableName

func (c *Cron) TableName() string

TableName returns name of table

func (*Cron) UID

func (c *Cron) UID() string

UID returns unique identifier for cron task

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) Commit

func (tr *DbTransaction) Commit() error

Commit is transaction commit

func (*DbTransaction) Rollback

func (tr *DbTransaction) Rollback()

Rollback is transaction rollback

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"`
}

InfoBlock is model

func BlockGetUnsent

func BlockGetUnsent() (*InfoBlock, error)

BlockGetUnsent returns InfoBlock

func (*InfoBlock) Create

func (ib *InfoBlock) Create(transaction *DbTransaction) error

Create is creating record of model

func (*InfoBlock) Get

func (ib *InfoBlock) Get() (bool, error)

Get is retrieving model from database

func (*InfoBlock) GetUnsent

func (ib *InfoBlock) GetUnsent() (bool, error)

GetUnsent is retrieving model from database

func (*InfoBlock) MarkSent

func (ib *InfoBlock) MarkSent() error

MarkSent update model sent field

func (*InfoBlock) TableName

func (ib *InfoBlock) TableName() string

TableName returns name of table

func (*InfoBlock) Update

func (ib *InfoBlock) Update(transaction *DbTransaction) error

Update is update model

type Install

type Install struct {
	Progress string `gorm:"not null;size:10"`
}

Install is model

func (*Install) Create

func (i *Install) Create() error

Create is creating record of model

func (*Install) Get

func (i *Install) Get() error

Get is retrieving model from database

func (*Install) TableName

func (i *Install) TableName() string

TableName returns name of table

type Key

type Key struct {
	ID        int64  `gorm:"primary_key;not null"`
	PublicKey []byte `gorm:"column:pub;not null"`
	Amount    string `gorm:"not null"`
	// contains filtered or unexported fields
}

Key is model

func (*Key) Get

func (m *Key) Get(wallet int64) (bool, error)

Get is retrieving model from database

func (*Key) SetTablePrefix

func (m *Key) SetTablePrefix(prefix int64) *Key

SetTablePrefix is setting table prefix

func (Key) TableName

func (m Key) TableName() string

TableName returns name of table

type Language

type Language struct {
	Name       string `gorm:"primary_key;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) GetAll

func (l *Language) GetAll(prefix string) ([]Language, error)

GetAll is retrieving all records from database

func (*Language) SetTablePrefix

func (l *Language) SetTablePrefix(tablePrefix string)

SetTablePrefix is setting table prefix

func (*Language) TableName

func (l *Language) TableName() string

TableName returns name of table

func (*Language) ToMap

func (l *Language) ToMap() map[string]string

ToMap is converting model to map

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"`
	Time int64  `gorm:"not null"`
}

LogTransaction is model

func (*LogTransaction) Create

func (lt *LogTransaction) Create(transaction *DbTransaction) error

Create is creating record of model

func (*LogTransaction) GetByHash

func (lt *LogTransaction) GetByHash(hash []byte) (bool, error)

GetByHash returns LogTransactions existence by hash

type Menu struct {
	Name       string `gorm:"primary_key;not null;size:255"`
	Title      string `gorm:"not null"`
	Value      string `gorm:"not null"`
	Conditions string `gorm:"not null"`
	// contains filtered or unexported fields
}

Menu is model

func (m *Menu) Get(name string) (bool, error)

Get is retrieving model from database

func (m *Menu) SetTablePrefix(prefix string)

SetTablePrefix is setting table prefix

func (m Menu) TableName() string

TableName returns name of 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 OneRow

type OneRow struct {
	// contains filtered or unexported fields
}

OneRow is storing one row result

func GetOneRow

func GetOneRow(query string, args ...interface{}) *OneRow

GetOneRow returns one row

func GetOneRowTransaction

func GetOneRowTransaction(transaction *DbTransaction, query string, args ...interface{}) *OneRow

GetOneRowTransaction returns one row from transactions

func (*OneRow) Bytes

func (r *OneRow) Bytes() (map[string][]byte, error)

Bytes is extracts result from OneRow as []byte

func (*OneRow) Float64

func (r *OneRow) Float64() (map[string]float64, error)

Float64 is extracts result from OneRow as float64

func (*OneRow) Int

func (r *OneRow) Int() (map[string]int, error)

Int is extracts result from OneRow as int

func (*OneRow) Int64

func (r *OneRow) Int64() (map[string]int64, error)

Int64 is extracts result from OneRow as int64

func (*OneRow) String

func (r *OneRow) String() (map[string]string, error)

String is extracts result from OneRow as string

type Page

type Page struct {
	Name       string `gorm:"primary_key;not null;size:255"`
	Value      string `gorm:"not null"`
	Menu       string `gorm:"not null;size:255"`
	Conditions string `gorm:"not null"`
	// contains filtered or unexported fields
}

Page is model

func (*Page) Get

func (p *Page) Get(name string) (bool, error)

Get is retrieving model from database

func (*Page) SetTablePrefix

func (p *Page) SetTablePrefix(prefix string)

SetTablePrefix is setting table prefix

func (*Page) TableName

func (p *Page) TableName() string

TableName returns name of table

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) Create

func (qb *QueueBlock) Create() error

Create is creating record of model

func (*QueueBlock) Delete

func (qb *QueueBlock) Delete() error

Delete is deleting queue

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

func GetAllUnverifiedAndUnusedTransactions() ([]*QueueTx, error)

GetAllUnverifiedAndUnusedTransactions is returns all unverified and unused transaction

func (*QueueTx) Create

func (qt *QueueTx) Create() error

Create is creating record of model

func (*QueueTx) DeleteTx

func (qt *QueueTx) DeleteTx() error

DeleteTx is deleting tx

func (*QueueTx) GetByHash

func (qt *QueueTx) GetByHash(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

func (*QueueTx) TableName

func (qt *QueueTx) 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)

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)

func (RollbackTx) TableName

func (RollbackTx) TableName() string

TableName returns name of table

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) Get

func (s *Signature) Get(name string) (bool, error)

Get is retrieving model from database

func (*Signature) SetTablePrefix

func (s *Signature) SetTablePrefix(prefix string)

SetTablePrefix is setting table prefix

func (*Signature) TableName

func (s *Signature) TableName() string

TableName returns name of table

type SingleResult

type SingleResult struct {
	// contains filtered or unexported fields
}

SingleResult is a structure for the single result

func Single

func Single(query string, args ...interface{}) *SingleResult

Single is retrieving single result

func (*SingleResult) Bytes

func (r *SingleResult) Bytes() ([]byte, error)

Bytes returns []byte

func (*SingleResult) Float64

func (r *SingleResult) Float64() (float64, error)

Float64 converts string to float64

func (*SingleResult) Int

func (r *SingleResult) Int() (int, error)

Int converts bytes to int

func (*SingleResult) Int64

func (r *SingleResult) Int64() (int64, error)

Int64 converts bytes to int64

func (*SingleResult) String

func (r *SingleResult) String() (string, error)

String returns string

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(tablePrefix 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) Create

func (sd *StopDaemon) Create() error

Create is creating record of model

func (*StopDaemon) Delete

func (sd *StopDaemon) Delete() error

Delete is deleting record

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) 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 SystemState

type SystemState struct {
	ID int64 `gorm:"primary_key;not null"`
}

SystemState is model

func (*SystemState) Delete

func (ss *SystemState) Delete(transaction *DbTransaction) error

Delete is deleting record

func (*SystemState) TableName

func (ss *SystemState) TableName() string

TableName returns name of table

type Table

type Table struct {
	ID          int64  `gorm:"primary_key;not null"`
	Name        string `gorm:"not null;size:100"`
	Permissions string `gorm:"not null;type:jsonb(PostgreSQL)"`
	Columns     string `gorm:"not null"`
	Conditions  string `gorm:"not null"`
	// contains filtered or unexported fields
}

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) GetAll

func (t *Table) GetAll(prefix string) ([]Table, error)

GetAll returns all tables

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

func (t *Table) SetTablePrefix(prefix string)

SetTablePrefix is setting table prefix

func (*Table) TableName

func (t *Table) TableName() string

TableName returns name of table

type TableVDE

type TableVDE struct {
	ID          int64  `gorm:"primary_key;not null"`
	Name        string `gorm:"not null;size:100"`
	Permissions string `gorm:"not null;type:jsonb(PostgreSQL)"`
	Columns     string `gorm:"not null"`
	Conditions  string `gorm:"not null"`
	// contains filtered or unexported fields
}

TableVDE is model

func (*TableVDE) Create

func (t *TableVDE) Create(transaction *DbTransaction) error

Create is creating record of model

func (*TableVDE) SetTablePrefix

func (t *TableVDE) SetTablePrefix(prefix string)

SetTablePrefix is setting table prefix

func (*TableVDE) TableName

func (t *TableVDE) TableName() string

TableName returns name of table

type Transaction

type Transaction struct {
	Hash     []byte `gorm:"private_key;not null"`
	Data     []byte `gorm:"not null"`
	Used     int8   `gorm:"not null"`
	HighRate int8   `gorm:"not null"`
	Type     int8   `gorm:"not null"`
	KeyID    int64  `gorm:"not null"`
	Counter  int8   `gorm:"not null"`
	Sent     int8   `gorm:"not null"`
	Verified int8   `gorm:"not null;default:1"`
}

Transaction is model

func GetAllUnusedTransactions

func GetAllUnusedTransactions() ([]Transaction, error)

GetAllUnusedTransactions is retrieving all unused transactions

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

func (*Transaction) Read

func (t *Transaction) Read(hash []byte) (bool, error)

Read is checking transaction existence 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(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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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