Documentation
¶
Index ¶
- Constants
- func CommentArticleIncentive(comment *ArticleComment, db *gorm.DB)
- func GetState(key string, dbi *gorm.DB) string
- func IdentifyUser(user *User, db *gorm.DB)
- func LikeArticleIncentive(like *ArticleLike, db *gorm.DB)
- func MigrateAll()
- func SetState(key, value string, dbi *gorm.DB)
- func ShareArticleIncentive(share *GroupArticle, db *gorm.DB)
- type Article
- func (article *Article) DetectLanguage() (string, error)
- func (article *Article) FromMetadata(title, contentHash, license, blockHash, extras, signature, DNA []byte) error
- func (article *Article) GenerateAbstract() (string, error)
- func (article *Article) GenerateContentHash() (string, error)
- func (article *Article) GenerateDNA() (string, error)
- func (article *Article) GetContent(db *gorm.DB) (string, error)
- func (article *Article) GetDNA() string
- func (article *Article) GetDNABaseString() string
- func (article *Article) GetSignatureBaseString() string
- func (article *Article) GetUserAddress() string
- func (article *Article) ToMetadata() (title, contentHash, license, blockHash, extras, signature, DNA []byte, ...)
- type ArticleComment
- type ArticleContent
- type ArticleLike
- type ArticleShareBatch
- type Group
- type GroupArticle
- type GroupIncentive
- type GroupMember
- type Incentive
- type System
- type TokenLock
- type TotalScore
- type User
Constants ¶
View Source
const IncentiveFromArticle = 1
View Source
const IncentiveFromComment = 4
View Source
const IncentiveFromGroup = 2
View Source
const IncentiveFromLike = 3
View Source
const IncentivesCalculating = 2
View Source
const IncentivesPaid = 3
View Source
const IncentivesPending = 1
View Source
const TokenLockResourceArticle = 1
View Source
const TokenLockResourceGroup = 0
View Source
const TxStatusConfirmed = 2
View Source
const TxStatusPending = 1
Variables ¶
This section is empty.
Functions ¶
func CommentArticleIncentive ¶
func CommentArticleIncentive(comment *ArticleComment, db *gorm.DB)
func IdentifyUser ¶
func LikeArticleIncentive ¶
func LikeArticleIncentive(like *ArticleLike, db *gorm.DB)
func MigrateAll ¶
func MigrateAll()
func ShareArticleIncentive ¶
func ShareArticleIncentive(share *GroupArticle, db *gorm.DB)
Types ¶
type Article ¶
type Article struct { ID uint `gorm:"primary_key"` CreatedAt uint UserAddress string `gorm:"size:255" binding:"required"` Title string `gorm:"type:text" binding:"required"` Abstract string `gorm:"type:text"` Content string `sql:"-" binding:"required"` ContentHash string `gorm:"size:255"` BlockHash string `gorm:"size:255"` DNA string `gorm:"size:255;unique_index"` License string `gorm:"type:text" binding:"required"` Extra string `gorm:"type:text" binding:"required"` Signature string `sql:"-" binding:"required"` Status string `gorm:"size:64"` TxStatus int `gorm:"type:int"` LikeCount uint `gorm:"default:0"` CommentCount uint `gorm:"default:0"` TotalIncentives decimal.Decimal `gorm:"type:decimal(65);default:0"` // Relations Author User `gorm:"ForeignKey:UserAddress;AssociationForeignKey:Address" binding:"-"` // Temp fields GroupDNA string `sql:"-" binding:"-"` }
func (*Article) DetectLanguage ¶
func (*Article) FromMetadata ¶
func (*Article) GenerateAbstract ¶
func (*Article) GenerateContentHash ¶
func (*Article) GenerateDNA ¶
func (*Article) GetDNABaseString ¶
func (*Article) GetSignatureBaseString ¶
func (*Article) GetUserAddress ¶
func (*Article) ToMetadata ¶
type ArticleComment ¶
type ArticleComment struct { ID uint `gorm:"primary_key"` CreatedAt uint GroupDNA string `gorm:"size:255"` GroupMemberAddress string `gorm:"size:255" binding:"required"` ArticleDNA string `gorm:"size:255"` Content string `gorm:"type:longtext" binding:"required"` ContentHash string `gorm:"size:255"` Signature string `sql:"-" binding:"required"` TxStatus int `gorm:"type:int"` // Relations Author User `gorm:"ForeignKey:GroupMemberAddress;AssociationForeignKey:Address" binding:"-"` }
func (*ArticleComment) GenerateContentHash ¶
func (comment *ArticleComment) GenerateContentHash() (string, error)
func (*ArticleComment) GetSignatureBaseString ¶
func (comment *ArticleComment) GetSignatureBaseString() string
type ArticleContent ¶
type ArticleContent struct { ID uint `gorm:"primary_key"` CreatedAt uint DNA string `gorm:"size:255;unique_index"` Content string `gorm:"type:longtext"` }
func NewArticleContent ¶
func NewArticleContent(DNA, Content string) *ArticleContent
type ArticleLike ¶
type ArticleLike struct { ID uint `gorm:"primary_key"` CreatedAt uint ArticleDNA string `gorm:"size:255"` GroupDNA string `gorm:"size:255" binding:"required"` GroupMemberAddress string `gorm:"size:255" binding:"required"` Signature string `sql:"-" binding:"required"` TxStatus int `gorm:"type:int"` }
func (*ArticleLike) GetSignatureBaseString ¶
func (like *ArticleLike) GetSignatureBaseString() string
type ArticleShareBatch ¶
type ArticleShareBatch struct {}
func (*ArticleShareBatch) FromConcatenatedGroupDNA ¶
func (shareBatch *ArticleShareBatch) FromConcatenatedGroupDNA(groupsDNA string)
func (*ArticleShareBatch) GetConcatenatedGroupDNAString ¶
func (shareBatch *ArticleShareBatch) GetConcatenatedGroupDNAString() string
func (*ArticleShareBatch) GetSignatureBaseString ¶
func (shareBatch *ArticleShareBatch) GetSignatureBaseString() string
type Group ¶
type Group struct { ID uint `gorm:"primary_key"` CreatedAt uint UserAddress string `gorm:"size:255" binding:"required"` Title string `gorm:"type:text" binding:"required"` Description string `gorm:"type:text" binding:"required"` Signature string `sql:"-" binding:"required"` DNA string `gorm:"size:255;unique_index"` Status string `gorm:"size:64"` TxStatus int `gorm:"type:int"` MemberCount uint `gorm:"type:int unsigned;default:0"` ArticleCount uint `gorm:"type:int unsigned;default:0"` // Relations IsMember *GroupMember `sql:"-" binding:"-"` GroupArticles []Article `sql:"-" binding:"-"` }
func (*Group) GenerateDNA ¶
func (*Group) GetDNABaseString ¶
func (*Group) GetSignatureBaseString ¶
type GroupArticle ¶
type GroupArticle struct { ID uint `gorm:"primary_key"` CreatedAt uint GroupDNA string `gorm:"size:255"` ArticleDNA string `gorm:"size:255" binding:"required"` MemberAddress string `gorm:"size:255" binding:"required"` Signature string `sql:"-" binding:"required"` TxStatus int `gorm:"type:int"` }
func (*GroupArticle) GetSignatureBaseString ¶
func (groupArticle *GroupArticle) GetSignatureBaseString() string
type GroupIncentive ¶
type GroupMember ¶
type GroupMember struct { ID uint `gorm:"primary_key"` CreatedAt uint GroupDNA string `gorm:"size:255"` MemberAddress string `gorm:"size:255" binding:"required"` Signature string `sql:"-" binding:"required"` TxStatus int `gorm:"type:int"` }
func (*GroupMember) GetOwnerSignatureBaseString ¶
func (groupMember *GroupMember) GetOwnerSignatureBaseString() string
func (*GroupMember) GetSignatureBaseString ¶
func (groupMember *GroupMember) GetSignatureBaseString() string
type Incentive ¶
type Incentive struct { ID uint `gorm:"primary_key"` CreatedAt uint IncentiveType uint `gorm:"index"` UserAddress string `gorm:"index"` ArticleDNA string `gorm:"index"` GroupDNA string `gorm:"index"` Amount decimal.Decimal `gorm:"type:decimal(65)"` Status uint `gorm:"index"` Score decimal.Decimal `gorm:"type:decimal(65)"` // Relations IncentiveArticle Article `gorm:"ForeignKey:ArticleDNA;AssociationForeignKey:DNA"` IncentiveGroup Group `gorm:"ForeignKey:GroupDNA;AssociationForeignKey:DNA"` }
type TotalScore ¶
type User ¶
type User struct { ID uint `gorm:"primary_key"` CreatedAt uint Address string `gorm:"size:255;unique_index" binding:"required"` Name string `gorm:"type:text" binding:"required"` Extra string `gorm:"type:text" binding:"required"` Signature string `gorm:"type:text" binding:"required"` Balance decimal.Decimal `gorm:"type:decimal(65)" binding:"-"` TokenBurned int `gorm:"type:tinyint" binding:"-"` UserArticles []Article `sql:"-" binding:"-"` UserGroups []Group `sql:"-" binding:"-"` }
Click to show internal directories.
Click to hide internal directories.