Documentation ¶
Index ¶
- Constants
- func GetAuthorCount(db *xorm.Engine, from, to int64, app string) (int64, error)
- func GetContentCount(db *xorm.Engine, from, to int64, app string) (int64, error)
- func GetLastHeight(db *xorm.Engine) (int64, error)
- func InitMySQLXorm(addr string, showSQL bool) *xorm.Engine
- func InsertFailRecord(db *xorm.Engine, height int64) (err error)
- func InsertOne(db *xorm.Engine, height int64) error
- func SaveContentsToDB(session *xorm.Session, contents []*Content) error
- func UpdateArticleAndBlockInfoInTransaction(db *xorm.Engine, contents []*Content, s *ScanBlockInfo, r *ScanBlockFailRecord) error
- func UpdateBlockInfoInTransaction(db *xorm.Engine, height int64) error
- type Article
- type ArticleDigest
- type CheckTag
- type Content
- func GetContentByHash(db *xorm.Engine, hash string) (*Content, error)
- func GetContents(db *xorm.Engine, ts, height int64, from, to, contributor, appName string, ...) (contents []*Content, total int64, err error)
- func GetTop(db *xorm.Engine, top int, app string) (contents []*Content, total int64, err error)
- func Search(db *xorm.Engine, key string, offset, limit int64, app string) (contents []*Content, total int64, err error)
- type Contributor
- type HistoryBlock
- type HistoryFail
- type ScanBlockFailRecord
- type ScanBlockInfo
Constants ¶
View Source
const ( SCAN_BLOCK_INFO = "scan_block_info" ARWEAVE = "arweave" )
View Source
const (
CONTENT_TABLE = "content"
)
View Source
const (
SCAN_BLOCK_FAIL_INFO = "scan_block_fail_info"
)
Variables ¶
This section is empty.
Functions ¶
func GetAuthorCount ¶
func GetContentCount ¶
func UpdateArticleAndBlockInfoInTransaction ¶
func UpdateArticleAndBlockInfoInTransaction(db *xorm.Engine, contents []*Content, s *ScanBlockInfo, r *ScanBlockFailRecord) error
Types ¶
type ArticleDigest ¶
type ArticleDigest struct { Ar Article `json:"content"` OriginalDigest string `json:"originalDigest"` }
func ArticleDigestFromJSONStr ¶
func ArticleDigestFromJSONStr(v []byte) (*ArticleDigest, error)
func (*ArticleDigest) ToJSONStr ¶
func (ad *ArticleDigest) ToJSONStr() (string, error)
type Content ¶
type Content struct { ID int `xorm:"int(10) 'id' pk autoincr" json:"-"` Ts int64 `xorm:"'ts' bigint(1) not null default 0 " json:"ts"` Height int64 `xorm:"'height' bigint(1) not null default 0 index" json:"height"` TxHash string `xorm:"'tx_hash' varchar(100) not null index" json:"tx_hash"` From string `xorm:"'trans_from' varchar(200) not null " json:"from"` To string `xorm:"'trans_to' varchar(200) not null " json:"to"` Content string `xorm:"'content' text not null " json:"content"` Title string `xorm:"'title' text not null " json:"title"` Contributor string `xorm:"'contributor' varchar(200) not null " json:"contributor"` OriginalDigest string `xorm:"'original_digest' varchar(200) not null " json:"original_digest"` AppName string `xorm:"'app_name' varchar(100) not null " json:"app_name"` }
func GetContents ¶
type Contributor ¶
type Contributor struct {
Contributor string `xorm:"'contributor' varchar(200)" json:"contributor"`
}
type HistoryBlock ¶
type HistoryBlock struct { Timestamp int64 `json:"timestamp"` Height int64 `json:"height"` Txs struct { Docs []struct { Transfers []struct { From []struct { Address string `json:"address"` } `json:"from"` } `json:"transfers"` Hash string `json:"hash"` Extra struct { Tags []struct { Name string `json:"name"` Value string `json:"value"` } `json:"tags"` } `json:"extra"` } `json:"docs"` HasNextPage bool `json:"hasNextPage"` NextPage int `json:"nextPage"` } `json:"txs"` }
func HistoryBlockFromJSONStr ¶
func HistoryBlockFromJSONStr(v []byte) (*HistoryBlock, error)
func (*HistoryBlock) GetContentInfo ¶
func (hb *HistoryBlock) GetContentInfo(addr string, app string) (contents []*Content)
func (*HistoryBlock) ToJSONStr ¶
func (hb *HistoryBlock) ToJSONStr() (string, error)
type HistoryFail ¶
type HistoryFail struct { ID int `xorm:"int(10) 'id' pk autoincr" json:"-"` Height int64 `xorm:"'height' bigint(1) not null default 0 " json:"height"` }
func GetAllHistoryFail ¶
func (*HistoryFail) TableName ¶
func (hf *HistoryFail) TableName() string
type ScanBlockFailRecord ¶
type ScanBlockFailRecord struct { ID int `xorm:"int(10) 'id' pk autoincr" json:"-"` Height int64 `xorm:"'height' bigint(1) not null default 0 " json:"last_height"` DataSource string `xorm:"'data_source' varchar(100) not null" json:"data_source"` }
func GetFailRecords ¶
func GetFailRecords(db *xorm.Engine) (rs []*ScanBlockFailRecord, total int64, err error)
func (*ScanBlockFailRecord) DeleteFailRecords ¶
func (s *ScanBlockFailRecord) DeleteFailRecords(session *xorm.Session) (err error)
func (*ScanBlockFailRecord) TableName ¶
func (s *ScanBlockFailRecord) TableName() string
type ScanBlockInfo ¶
type ScanBlockInfo struct { ID int `xorm:"int(10) 'id' pk autoincr" json:"-"` LastHeight int64 `xorm:"'last_height' bigint(1) not null default 0 " json:"last_height"` DataSource string `xorm:"'data_source' varchar(100) not null index" json:"data_source"` Ts int64 `xorm:"'ts' bigint(1) not null default 0 " json:"ts"` }
func GetScanBlockInfo ¶
func GetScanBlockInfo(db *xorm.Engine) (*ScanBlockInfo, error)
func (*ScanBlockInfo) TableName ¶
func (s *ScanBlockInfo) TableName() string
Click to show internal directories.
Click to hide internal directories.