Documentation ¶
Overview ¶
Package adapter is an alias of the interface concept in domain driven development. In Golang "interface" is a language keyword and so "adapter" is used instead.
Index ¶
- Variables
- func ActivityTypeToString(activityType chainindex.ActivityType) string
- func EventTypeToString(eventType chainindex.EventType) string
- func IsValidActivityType(transactionType string) bool
- func IsValidEventType(eventType string) bool
- func IsValidTransactionType(transactionType string) bool
- func OptPunishmentKindToString(punishmentKind *chainindex.PunishmentKind) *string
- func ParseBlockToBlockData(rawBlockData TendermintBlockData) *usecase.BlockData
- func ParseGenesisToBlockData(rawBlockData TendermintGenesisBlockData) *usecase.BlockData
- func PubKeyTypeFromString(pubKeyType string) chainindex.PubKeyType
- func PubKeyTypeToString(pubKeyType chainindex.PubKeyType) string
- func PunishmentKindFromString(punishmentKind string) chainindex.PunishmentKind
- func PunishmentKindToString(punishmentKind chainindex.PunishmentKind) string
- func RDbCouncilNodeRowToCouncilNode(row *RDbCouncilNodeRow) *chainindex.CouncilNode
- func StringToActivityType(transactionType string) chainindex.ActivityType
- func StringToEventType(eventType string) chainindex.EventType
- func StringToTransactionType(transactionType string) chainindex.TransactionType
- func TransactionTypeToString(transactionType chainindex.TransactionType) string
- type DefaultRDbBlockActivityDataRepo
- func (repo *DefaultRDbBlockActivityDataRepo) InsertDepositTransaction(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertGenesisActivity(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertJailEvent(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertNodeJoinTransaction(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertRewardEvent(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertSlashEvent(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertTransferTransaction(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertUnbondTransaction(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertUnjailTransaction(tx RDbTx, activity *chainindex.Activity) error
- func (repo *DefaultRDbBlockActivityDataRepo) InsertWithdrawTransaction(tx RDbTx, activity *chainindex.Activity) error
- type RDbBlockActivityDataRepo
- type RDbBlockCommittedCouncilNodeRow
- type RDbBlockDataRepo
- type RDbConn
- type RDbCouncilNodeRow
- type RDbExecResult
- type RDbNtobReader
- type RDbNtotReader
- type RDbPaginationBuilder
- type RDbPaginationSQLBuilder
- type RDbPaginationStmtBuilder
- type RDbRowResult
- type RDbRowsResult
- type RDbRunner
- type RDbStakingAccountRow
- type RDbTransferInputRow
- type RDbTx
- type RDbTypeConv
- type StakingDiffConfidentialInit
- type StakingDiffConsensusPubKey
- type StakingDiffCouncilNode
- type StakingDiffKVPair
- type StakingDiffs
- type TendermintBlockData
- type TendermintGenesisBlockData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ATTRIBUTE_FEE = base64.StdEncoding.EncodeToString([]byte("fee")) ATTRIBUTE_TXID = base64.StdEncoding.EncodeToString([]byte("txid")) ATTRIBUTE_SATKING_ADDRESS = base64.StdEncoding.EncodeToString([]byte("staking_address")) ATTRIBUTE_STAKING_OPTYPE = base64.StdEncoding.EncodeToString([]byte("staking_optype")) ATTRIBUTE_STAKING_OPREASON = base64.StdEncoding.EncodeToString([]byte("staking_opreason")) ATTRIBUTE_STAKING_DIFF = base64.StdEncoding.EncodeToString([]byte("staking_diff")) ATTRIBUTE_MINTED = base64.StdEncoding.EncodeToString([]byte("minted")) )
View Source
var ( ErrBuildSQLStmt = fmt.Errorf("error building SQL statement: %w", ErrRepoPrepare) ErrTypeConv = fmt.Errorf("error converting between types: %w", ErrRepoPrepare) // when trying to scan a null row ErrNoRows = errors.New("no rows in result set") )
View Source
var ( ErrRepoPrepare = errors.New("error preparing repository operation") ErrRepoOpen = errors.New("error opening repository") ErrRepoQuery = errors.New("error querying from repository") ErrRepoWrite = errors.New("error writing to repository") )
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func ActivityTypeToString ¶
func ActivityTypeToString(activityType chainindex.ActivityType) string
func EventTypeToString ¶
func EventTypeToString(eventType chainindex.EventType) string
func IsValidActivityType ¶
func IsValidEventType ¶
func IsValidTransactionType ¶
func OptPunishmentKindToString ¶
func OptPunishmentKindToString(punishmentKind *chainindex.PunishmentKind) *string
func ParseBlockToBlockData ¶
func ParseBlockToBlockData(rawBlockData TendermintBlockData) *usecase.BlockData
func ParseGenesisToBlockData ¶
func ParseGenesisToBlockData(rawBlockData TendermintGenesisBlockData) *usecase.BlockData
func PubKeyTypeFromString ¶
func PubKeyTypeFromString(pubKeyType string) chainindex.PubKeyType
func PubKeyTypeToString ¶
func PubKeyTypeToString(pubKeyType chainindex.PubKeyType) string
func PunishmentKindFromString ¶
func PunishmentKindFromString(punishmentKind string) chainindex.PunishmentKind
func PunishmentKindToString ¶
func PunishmentKindToString(punishmentKind chainindex.PunishmentKind) string
func RDbCouncilNodeRowToCouncilNode ¶
func RDbCouncilNodeRowToCouncilNode(row *RDbCouncilNodeRow) *chainindex.CouncilNode
func StringToActivityType ¶
func StringToActivityType(transactionType string) chainindex.ActivityType
func StringToEventType ¶
func StringToEventType(eventType string) chainindex.EventType
func StringToTransactionType ¶
func StringToTransactionType(transactionType string) chainindex.TransactionType
func TransactionTypeToString ¶
func TransactionTypeToString(transactionType chainindex.TransactionType) string
Types ¶
type DefaultRDbBlockActivityDataRepo ¶
type DefaultRDbBlockActivityDataRepo struct {
// contains filtered or unexported fields
}
func NewDefaultRDbBlockActivityDataRepo ¶
func NewDefaultRDbBlockActivityDataRepo(stmtBuilder sq.StatementBuilderType, typeConv RDbTypeConv) *DefaultRDbBlockActivityDataRepo
func (*DefaultRDbBlockActivityDataRepo) InsertDepositTransaction ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertDepositTransaction(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertGenesisActivity ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertGenesisActivity(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertJailEvent ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertJailEvent(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertNodeJoinTransaction ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertNodeJoinTransaction(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertRewardEvent ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertRewardEvent(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertSlashEvent ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertSlashEvent(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertTransferTransaction ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertTransferTransaction(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertUnbondTransaction ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertUnbondTransaction(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertUnjailTransaction ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertUnjailTransaction(tx RDbTx, activity *chainindex.Activity) error
func (*DefaultRDbBlockActivityDataRepo) InsertWithdrawTransaction ¶
func (repo *DefaultRDbBlockActivityDataRepo) InsertWithdrawTransaction(tx RDbTx, activity *chainindex.Activity) error
type RDbBlockActivityDataRepo ¶
type RDbBlockActivityDataRepo interface { InsertGenesisActivity(tx RDbTx, activity *chainindex.Activity) error InsertTransferTransaction(tx RDbTx, activity *chainindex.Activity) error InsertDepositTransaction(tx RDbTx, activity *chainindex.Activity) error InsertUnbondTransaction(tx RDbTx, activity *chainindex.Activity) error InsertWithdrawTransaction(tx RDbTx, activity *chainindex.Activity) error InsertNodeJoinTransaction(tx RDbTx, activity *chainindex.Activity) error InsertUnjailTransaction(tx RDbTx, activity *chainindex.Activity) error InsertRewardEvent(tx RDbTx, activity *chainindex.Activity) error InsertSlashEvent(tx RDbTx, activity *chainindex.Activity) error InsertJailEvent(tx RDbTx, activity *chainindex.Activity) error }
type RDbBlockCommittedCouncilNodeRow ¶
type RDbBlockCommittedCouncilNodeRow struct { BlockHeight uint64 `json:"-"` ID uint64 `json:"id"` Name string `json:"name"` CouncilNodeAddress string `json:"address"` Signature string `json:"signature"` IsProposer bool `json:"is_proposer"` }
func (*RDbBlockCommittedCouncilNodeRow) String ¶
func (row *RDbBlockCommittedCouncilNodeRow) String() string
type RDbBlockDataRepo ¶
type RDbBlockDataRepo struct {
// contains filtered or unexported fields
}
func NewRDbBlockDataRepo ¶
func NewRDbBlockDataRepo( conn RDbConn, stmtBuilder sq.StatementBuilderType, typeConv RDbTypeConv, activityDataRepo RDbBlockActivityDataRepo, ) *RDbBlockDataRepo
type RDbConn ¶
type RDbConn interface { Begin() (RDbTx, error) Exec(sql string, args ...interface{}) (RDbExecResult, error) Query(sql string, args ...interface{}) (RDbRowsResult, error) QueryRow(sql string, args ...interface{}) RDbRowResult }
type RDbCouncilNodeRow ¶
type RDbCouncilNodeRow struct { ID *uint64 `json:"id"` Name string `json:"name"` MaybeSecurityContact *string `json:"security_contact"` PubKeyType string `json:"pubkey_type"` PubKey string `json:"pubkey"` Address string `json:"address"` CreatedAtBlockHeight uint64 `json:"created_at_block_height"` MaybeLastLeftAtBlockHeight *uint64 `json:"last_left_at_block_height"` }
func CouncilNodeToRDbCouncilNodeRow ¶
func CouncilNodeToRDbCouncilNodeRow(node *chainindex.CouncilNode) *RDbCouncilNodeRow
func (*RDbCouncilNodeRow) String ¶
func (row *RDbCouncilNodeRow) String() string
type RDbExecResult ¶
type RDbNtobReader ¶
type RDbNtotReader ¶
type RDbPaginationBuilder ¶
type RDbPaginationBuilder struct { *viewrepo.Pagination // contains filtered or unexported fields }
func NewRDbPaginationBuilder ¶
func NewRDbPaginationBuilder(pagination *viewrepo.Pagination, conn RDbConn) *RDbPaginationBuilder
func (*RDbPaginationBuilder) BuildSQL ¶
func (pagination *RDbPaginationBuilder) BuildSQL(sql string, args ...interface{}) *RDbPaginationSQLBuilder
func (*RDbPaginationBuilder) BuildStmt ¶
func (pagination *RDbPaginationBuilder) BuildStmt(stmtBuilder sq.SelectBuilder) *RDbPaginationStmtBuilder
type RDbPaginationSQLBuilder ¶
type RDbPaginationSQLBuilder struct { *viewrepo.Pagination // contains filtered or unexported fields }
func (*RDbPaginationSQLBuilder) Result ¶
func (pagination *RDbPaginationSQLBuilder) Result() (*viewrepo.PaginationResult, error)
func (*RDbPaginationSQLBuilder) ToSQL ¶
func (pagination *RDbPaginationSQLBuilder) ToSQL() (string, []interface{})
type RDbPaginationStmtBuilder ¶
type RDbPaginationStmtBuilder struct { *viewrepo.Pagination // contains filtered or unexported fields }
func (*RDbPaginationStmtBuilder) Result ¶
func (pagination *RDbPaginationStmtBuilder) Result() (*viewrepo.PaginationResult, error)
func (*RDbPaginationStmtBuilder) ToStmtBuilder ¶
func (pagination *RDbPaginationStmtBuilder) ToStmtBuilder() sq.SelectBuilder
type RDbRowResult ¶
type RDbRowResult interface {
Scan(dest ...interface{}) error
}
type RDbRowsResult ¶
type RDbRowsResult interface { Close() Err() error ExecResult() RDbExecResult Next() bool Scan(dest ...interface{}) error }
type RDbRunner ¶
type RDbRunner interface { Exec(sql string, args ...interface{}) (RDbExecResult, error) Query(sql string, args ...interface{}) (RDbRowsResult, error) QueryRow(sql string, args ...interface{}) RDbRowResult }
Implementing RDbConn and RDbTx interface automatically fullfills RDbRunner
type RDbStakingAccountRow ¶
type RDbStakingAccountRow struct { Address string Nonce uint64 Bonded *big.Int Unbonded *big.Int UnbondedFrom *time.Time PunishmentKind *string JailedUntil *time.Time CurrentCouncilNodeId *uint64 }
func (*RDbStakingAccountRow) AddBonded ¶
func (row *RDbStakingAccountRow) AddBonded(value *big.Int)
func (*RDbStakingAccountRow) AddUnbonded ¶
func (row *RDbStakingAccountRow) AddUnbonded(value *big.Int)
func (*RDbStakingAccountRow) IncrementNonce ¶
func (row *RDbStakingAccountRow) IncrementNonce()
func (*RDbStakingAccountRow) String ¶
func (row *RDbStakingAccountRow) String() string
type RDbTransferInputRow ¶
type RDbTransferInputRow struct { TxID string `json:"prev_txid"` Index int32 `json:"prev_output_index"` }
func TxInputsToRDbTransferInputs ¶
func TxInputsToRDbTransferInputs(inputs []chainindex.TxInput) []RDbTransferInputRow
type RDbTx ¶
type RDbTx interface { Exec(sql string, args ...interface{}) (RDbExecResult, error) Query(sql string, args ...interface{}) (RDbRowsResult, error) QueryRow(sql string, args ...interface{}) RDbRowResult Commit() error Rollback() error }
type RDbTypeConv ¶
type RDbTypeConv interface { // convert big.Int to native number pointer. Return nil if big.Int is nil Bton(*big.Int) interface{} Iton(int) interface{} // native number reader and parser to big.Int NtobReader() RDbNtobReader // convert time.Time to native time format pointer. Return nil if time // is nil Tton(*time.Time) interface{} NtotReader() RDbNtotReader }
type StakingDiffConfidentialInit ¶
type StakingDiffConfidentialInit struct {
Cert string `json:"cert"`
}
type StakingDiffCouncilNode ¶
type StakingDiffCouncilNode struct { Name string `json:"name"` SecurityContact string `json:"security_contact"` ConsensusPubKey StakingDiffConsensusPubKey `json:"consensus_pubkey"` ConfidentialInit StakingDiffConfidentialInit `json:"confidential_init"` }
type StakingDiffKVPair ¶
type StakingDiffKVPair struct { Key string `json:"key"` Value interface{} `json:"value"` }
type StakingDiffs ¶
type StakingDiffs = []StakingDiffKVPair
type TendermintBlockData ¶
type TendermintBlockData struct { Block *tenderminttypes.Block BlockResults *tenderminttypes.BlockResults }
type TendermintGenesisBlockData ¶
type TendermintGenesisBlockData struct { Genesis *tenderminttypes.Genesis Block *tenderminttypes.Block }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.