Documentation
¶
Index ¶
- Constants
- func ToString(queryMap interface{}) string
- func ToStringD(queryMap bson.D) string
- type AssetMessage
- type Block
- type BlockNonce
- type Bloom
- type DataPresaleMessage
- type FavoritMessage
- type FileMessage
- type MBlock
- type MTransaction
- type MongoContext
- func (c *MongoContext) GetCollection(db string, collection string) *mgo.Collection
- func (c *MongoContext) SetCollection(collection string, s func(*mgo.Collection) error) error
- func (c *MongoContext) SetCollectionByDB(db string, collection string, s func(*mgo.Collection) error) error
- func (c *MongoContext) SetCollectionCount(collection string, s func(*mgo.Collection) (int, error)) (int, error)
- type MongoRepository
- func (r *MongoRepository) CallDelUserToken(username string, token string) (uint32, error)
- func (r *MongoRepository) CallGetAllAssetList() ([]*util.AssetDBInfo, error)
- func (r *MongoRepository) CallGetAllRequirementList() ([]*util.RequirementDBInfo, error)
- func (r *MongoRepository) CallGetAllTxNum() (uint64, error)
- func (r *MongoRepository) CallGetAssetById(assertId string) (*util.AssetDBInfo, error)
- func (r *MongoRepository) CallGetAssetListByUser(username string) ([]*util.AssetDBInfo, error)
- func (r *MongoRepository) CallGetAssetNumByDay(begin time.Time, end time.Time) (uint64, error)
- func (r *MongoRepository) CallGetDataPresaleByUser(username string) ([]*util.DataPresaleDBInfo, error)
- func (r *MongoRepository) CallGetFavoritListByUser(username string) ([]*util.FavoritDBInfo, error)
- func (r *MongoRepository) CallGetNodeInfos() ([]*util.NodeDBInfo, error)
- func (r *MongoRepository) CallGetRecentTransfersList() ([]*util.TransferDBInfo, error)
- func (r *MongoRepository) CallGetRecentTxList() ([]*util.TxDBInfo, error)
- func (r *MongoRepository) CallGetRequirementListByFeature(featur_tag uint64) ([]*util.RequirementDBInfo, error)
- func (r *MongoRepository) CallGetRequirementNumByDay(begin time.Time, end time.Time) (uint64, error)
- func (r *MongoRepository) CallGetSumTxAmount() (uint64, error)
- func (r *MongoRepository) CallGetTxNumByDay(begin time.Time, end time.Time) (uint64, error)
- func (r *MongoRepository) CallGetUserFileList(username string) ([]*util.FileDBInfo, error)
- func (r *MongoRepository) CallGetUserPurchaseAssetList(username string) ([]*util.AssetDBInfo, error)
- func (r *MongoRepository) CallGetUserRequirementList(username string) ([]*util.RequirementDBInfo, error)
- func (r *MongoRepository) CallGetUserToken(username string, token string) (*util.TokenDBInfo, error)
- func (r *MongoRepository) CallGetUserTxList(username string) ([]*util.TxDBInfo, error)
- func (r *MongoRepository) CallInsertUserToken(username string, token string) (uint32, error)
- type NodeMessage
- type PurchaseMesssage
- type RequireMessage
- type Transaction
- type TransferMes
- type TransferMessage
- type TxMessage
- type UserToken
Constants ¶
const ( // BloomByteLength represents the number of bytes used in a header log bloom. BloomByteLength = 256 // BloomBitLength represents the number of bits used in a header log bloom. BloomBitLength = 8 * BloomByteLength )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetMessage ¶
type AssetMessage struct { ID bson.ObjectId `bson:"_id"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { AssetID string `bson:"asset_id"` BasicInfo struct { UserName string `bson:"user_name"` SessionID string `bson:"session_id"` AssetName string `bson:"asset_name"` FeatureTag uint64 `bson:"feature_tag"` SamplePath string `bson:"sample_path"` SampleHash string `bson:"sample_hash"` StoragePath string `bson:"storage_path"` StorageHash string `bson:"storage_hash"` ExpireTime uint32 `bson:"expire_time"` Price uint64 `bson:"price"` Description string `bson:"description"` UploadDate uint32 `bson:"upload_date"` Signature string `bson:"signature"` } `bson:"basic_info"` } `bson:"data"` CreatedAt time.Time `bson:"createdAt"` }
AssetMessage is definition of asset msg
type Block ¶
type Block struct { Difficulty string `json:"difficulty"` Extra string `json:"extraData"` GasLimit string `json:"gasLimit"` GasUsed string `json:"gasUsed"` Hash string `json:"hash"` Bloom string `json:"logsBloom"` Coinbase string `json:"miner"` MixDigest string `json:"mixHash"` Nonce string `json:"nonce"` Number string `json:"number"` ParentHash string `json:"parentHash"` ReceiptHash string `json:"receiptsRoot"` UncleHash string `json:"sha3Uncles"` Size string `json:"size"` Root string `json:"stateRoot"` Time string `json:"timestamp"` TotalDifficulty string `json:"totalDifficulty"` TXs []Transaction `json:"transactions"` TxHash string `json:"transactionsRoot"` Uncles []string `json:"uncles"` }
Block represents a block header in the Ethereum blockchain.
type BlockNonce ¶
type BlockNonce [8]byte
A BlockNonce is a 64-bit hash which proves (combined with the mix-hash) that a sufficient amount of computation has been carried out on a block.
type DataPresaleMessage ¶
type DataPresaleMessage struct { ID bson.ObjectId `bson:"_id"` BlockNum int `bson:"block_num"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { DataPresaleID string `bson:"data_presale_id"` BasicInfo struct { UserName string `bson:"user_name"` SessionID string `bson:"session_id"` AssetID string `bson:"asset_id"` DataReqID string `bson:"data_req_id"` Consumer string `bson:"consumer"` RandomNum int `bson:"random_num"` Signature string `bson:"signature"` } `bson:"basic_info"` } `bson:"data"` CreatedAt string `bson:"createdAt"` }
DataPresaleMessage is definition of data presale msg
type FavoritMessage ¶
type FavoritMessage struct { ID bson.ObjectId `bson:"_id"` BlockNum int `bson:"block_num"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { UserName string `bson:"user_name"` SessionID string `bson:"session_id"` OpType string `bson:"op_type"` GoodsType string `bson:"goods_type"` GoodsID string `bson:"goods_id"` Signature string `bson:"signature"` } `bson:"data"` CreatedAt string `bson:"createdAt"` }
FavoritMessage is definition of favorite msg
type FileMessage ¶
type FileMessage struct { ID string `bson:"_id"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { FileHash string `bson:"file_hash"` BasicInfo struct { UserName string `bson:"user_name"` SessionID string `bson:"session_id"` FileSize uint64 `bson:"file_size"` FileName string `bson:"file_name"` FilePolicy string `bson:"file_policy"` FileNumber uint64 `bson:"file_number"` Signature string `bson:"signature"` AuthPath string `bson:"auth_path"` } `bson:"basic_info"` } `bson:"data"` CreatedAt string `bson:"createdAt"` }
FileMessage is definition of file msg
type MBlock ¶
type MBlock struct { Difficulty bson.Decimal128 `bson:"difficulty"` Extra string `bson:"extraData"` GasLimit bson.Decimal128 `bson:"gasLimit"` GasUsed bson.Decimal128 `bson:"gasUsed"` Hash string `bson:"hash"` Bloom string `bson:"logsBloom"` Coinbase string `bson:"miner"` MixDigest string `bson:"mixHash"` Nonce string `bson:"nonce"` Number bson.Decimal128 `bson:"number"` ParentHash string `bson:"parentHash"` ReceiptHash string `bson:"receiptsRoot"` UncleHash string `bson:"sha3Uncles"` Size bson.Decimal128 `bson:"size"` Root string `bson:"stateRoot"` Time bson.Decimal128 `bson:"timestamp"` TotalDifficulty bson.Decimal128 `bson:"totalDifficulty"` TXs []MTransaction `bson:"transactions"` TxHash string `bson:"transactionsRoot"` Uncles []string `bson:"uncles"` }
MBlock represents a block header in Mongodbq.
type MTransaction ¶
type MTransaction struct { BlockHash string `bson:"blockHash"` BlockNumber bson.Decimal128 `bson:"blockNumber"` From string `bson:"from"` Gas bson.Decimal128 `bson:"gas"` GasPrice bson.Decimal128 `bson:"gasPrice"` Hash string `bson:"hash"` Input string `bson:"input"` Nonce string `bson:"nonce"` To string `bson:"to"` TransactionIndex bson.Decimal128 `bson:"transactionIndex"` Value bson.Decimal128 `bson:"value"` V string `bson:"v"` R string `bson:"r"` S string `bson:"s"` }
MTransaction represents a transaction that will serialize to the RPC representation of a transaction
type MongoContext ¶
type MongoContext struct {
// contains filtered or unexported fields
}
MongoContext is mongo context
func (*MongoContext) GetCollection ¶
func (c *MongoContext) GetCollection(db string, collection string) *mgo.Collection
GetCollection is getting collection from mongodb
func (*MongoContext) SetCollection ¶
func (c *MongoContext) SetCollection(collection string, s func(*mgo.Collection) error) error
SetCollection is setting collection
func (*MongoContext) SetCollectionByDB ¶
func (c *MongoContext) SetCollectionByDB(db string, collection string, s func(*mgo.Collection) error) error
SetCollectionByDB is setting collection by database
func (*MongoContext) SetCollectionCount ¶
func (c *MongoContext) SetCollectionCount(collection string, s func(*mgo.Collection) (int, error)) (int, error)
SetCollectionCount is setting collection by count
type MongoRepository ¶
type MongoRepository struct {
// contains filtered or unexported fields
}
MongoRepository is struct for mongodb struct
func NewMongoRepository ¶
func NewMongoRepository(endpoint string) *MongoRepository
NewMongoRepository creates a new MongoRepository
func (*MongoRepository) CallDelUserToken ¶
func (r *MongoRepository) CallDelUserToken(username string, token string) (uint32, error)
CallDelUserToken is to delete user token
func (*MongoRepository) CallGetAllAssetList ¶
func (r *MongoRepository) CallGetAllAssetList() ([]*util.AssetDBInfo, error)
CallGetAllAssetList is to get all asset list
func (*MongoRepository) CallGetAllRequirementList ¶
func (r *MongoRepository) CallGetAllRequirementList() ([]*util.RequirementDBInfo, error)
CallGetAllRequirementList is getting all requirement list
func (*MongoRepository) CallGetAllTxNum ¶
func (r *MongoRepository) CallGetAllTxNum() (uint64, error)
CallGetAllTxNum is getting all transaction number
func (*MongoRepository) CallGetAssetById ¶
func (r *MongoRepository) CallGetAssetById(assertId string) (*util.AssetDBInfo, error)
CallGetAssetById is to get asset by id
func (*MongoRepository) CallGetAssetListByUser ¶
func (r *MongoRepository) CallGetAssetListByUser(username string) ([]*util.AssetDBInfo, error)
CallGetAssetListByUser is to get asset list by user
func (*MongoRepository) CallGetAssetNumByDay ¶
CallGetAssetNumByDay is to get asset num by day
func (*MongoRepository) CallGetDataPresaleByUser ¶
func (r *MongoRepository) CallGetDataPresaleByUser(username string) ([]*util.DataPresaleDBInfo, error)
CallGetDataPresaleByUser is to get data presale by user
func (*MongoRepository) CallGetFavoritListByUser ¶
func (r *MongoRepository) CallGetFavoritListByUser(username string) ([]*util.FavoritDBInfo, error)
CallGetFavoritListByUser is to get favorite list by user
func (*MongoRepository) CallGetNodeInfos ¶
func (r *MongoRepository) CallGetNodeInfos() ([]*util.NodeDBInfo, error)
CallGetNodeInfos is to get node info
func (*MongoRepository) CallGetRecentTransfersList ¶
func (r *MongoRepository) CallGetRecentTransfersList() ([]*util.TransferDBInfo, error)
CallGetRecentTransfersList is getting recent transfers list
func (*MongoRepository) CallGetRecentTxList ¶
func (r *MongoRepository) CallGetRecentTxList() ([]*util.TxDBInfo, error)
CallGetRecentTxList is getting recent transaction lists
func (*MongoRepository) CallGetRequirementListByFeature ¶
func (r *MongoRepository) CallGetRequirementListByFeature(featur_tag uint64) ([]*util.RequirementDBInfo, error)
CallGetRequirementListByFeature is getting requirement list by feature
func (*MongoRepository) CallGetRequirementNumByDay ¶
func (r *MongoRepository) CallGetRequirementNumByDay(begin time.Time, end time.Time) (uint64, error)
CallGetRequirementNumByDay is getting requirement number by day
func (*MongoRepository) CallGetSumTxAmount ¶
func (r *MongoRepository) CallGetSumTxAmount() (uint64, error)
CallGetSumTxAmount is getting sum transaction amount
func (*MongoRepository) CallGetTxNumByDay ¶
CallGetTxNumByDay is getting transaction number by day
func (*MongoRepository) CallGetUserFileList ¶
func (r *MongoRepository) CallGetUserFileList(username string) ([]*util.FileDBInfo, error)
CallGetUserFileList is to get user file list
func (*MongoRepository) CallGetUserPurchaseAssetList ¶
func (r *MongoRepository) CallGetUserPurchaseAssetList(username string) ([]*util.AssetDBInfo, error)
CallGetUserPurchaseAssetList is to get user purchase asset list
func (*MongoRepository) CallGetUserRequirementList ¶
func (r *MongoRepository) CallGetUserRequirementList(username string) ([]*util.RequirementDBInfo, error)
CallGetUserRequirementList is getting user requirement list
func (*MongoRepository) CallGetUserToken ¶
func (r *MongoRepository) CallGetUserToken(username string, token string) (*util.TokenDBInfo, error)
CallGetUserToken is to get user token
func (*MongoRepository) CallGetUserTxList ¶
func (r *MongoRepository) CallGetUserTxList(username string) ([]*util.TxDBInfo, error)
CallGetUserTxList is getting User transaction list
func (*MongoRepository) CallInsertUserToken ¶
func (r *MongoRepository) CallInsertUserToken(username string, token string) (uint32, error)
CallInsertUserToken is to insert user token
type NodeMessage ¶
type NodeMessage struct { ID bson.ObjectId `bson:"_id"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { NodeID string `bson:"node_id"` BasicInfo struct { NodeIP string `bson:"node_ip"` NodePort string `bson:"node_port"` NodeAddress string `bson:"node_address"` } `bson:"basic_info"` } `bson:"data"` CreatedAt time.Time `bson:"createdAt"` }
NodeMessage is definition os node msg
type PurchaseMesssage ¶
type PurchaseMesssage struct { ID bson.ObjectId `bson:"_id"` BlockNum uint64 `bson:"block_num"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { DataDealID string `bson:"data_deal_id"` BasicInfo struct { UserName string `bson:"user_name"` SessionID string `bson:"session_id"` AssetID string `bson:"asset_id"` RandomNum int `bson:"random_num"` Signature string `bson:"signature"` } `bson:"basic_info"` } `bson:"data"` CreatedAt time.Time `bson:"createdAt"` }
PurchaseMesssage is purchase message
type RequireMessage ¶
type RequireMessage struct { ID bson.ObjectId `bson:"_id,omitempty"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { DataReqID string `bson:"data_req_id"` BasicInfo struct { UserName string `bson:"user_name"` SessionID string `bson:"session_id"` RequirementName string `bson:"requirement_name"` FeatureTag uint64 `bson:"feature_tag"` SamplePath string `bson:"sample_path"` SampleHash string `bson:"sample_hash"` ExpireTime uint32 `bson:"expire_time"` Price uint64 `bson:"price"` Description string `bson:"description"` PublishDate uint32 `bson:"publish_date"` Signature string `bson:"signature"` } `bson:"basic_info"` } `bson:"data"` CreatedAt string `bson:"createdAt"` }
RequireMessage is require message
type Transaction ¶
type Transaction struct { BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` From string `json:"from"` Gas string `json:"gas"` GasPrice string `json:"gasPrice"` Hash string `json:"hash"` Input string `json:"input"` Nonce string `json:"nonce"` To string `json:"to"` TransactionIndex string `json:"transactionIndex"` Value string `json:"value"` V string `json:"v"` R string `json:"r"` S string `json:"s"` }
Transaction represents a transaction that will serialize to the RPC representation of a transaction
type TransferMes ¶
type TransferMes struct { ID bson.ObjectId `bson:"_id"` BlockNum uint64 `bson:"block_num"` MessageID int `bson:"message_id"` TransactionID string `bson:"transaction_id"` Authorization []interface{} `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { From string `bson:"from"` To string `bson:"to"` Quantity uint64 `bson:"quantity"` } `bson:"data"` CreatedAt time.Time `bson:"createdAt"` }
TransferMes is transfer with quantity message
type TransferMessage ¶
type TransferMessage struct { ID bson.ObjectId `bson:"_id"` MessageID int `bson:"message_id"` BlockNum uint64 `bson:"block_num"` TransactionID string `bson:"transaction_id"` Authorization []struct { Account string `bson:"account"` Permission string `bson:"permission"` } `bson:"authorization"` HandlerAccountName string `bson:"handler_account_name"` Type string `bson:"type"` Data struct { From string `bson:"from"` To string `bson:"to"` Amount string `bson:"amount"` Memo string `bson:"memo"` } `bson:"data"` CreatedAt time.Time `bson:"createdAt"` }
TransferMessage is transfer message
type TxMessage ¶
type TxMessage struct { ID bson.ObjectId `bson:"_id"` TransactionID string `bson:"transaction_id"` SequenceNum int `bson:"sequence_num"` BlockID string `bson:"block_id"` RefBlockNum uint64 `bson:"ref_block_num"` RefBlockPrefix string `bson:"ref_block_prefix"` Scope []interface{} `bson:"scope"` ReadScope []interface{} `bson:"read_scope"` Expiration string `bson:"expiration"` Signatures []interface{} `bson:"signatures"` Messages []string `bson:"messages"` CreatedAt time.Time `bson:"createdAt"` }
TxMessage is transaction message