model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrFailedToMarshalPostComment

func ErrFailedToMarshalPostComment(err error) sdk.Error

ErrFailedToMarshalPostComment - error if marshal post comment failed

func ErrFailedToMarshalPostDonations

func ErrFailedToMarshalPostDonations(err error) sdk.Error

ErrFailedToMarshalPostDonations - error if marshal post donation failed

func ErrFailedToMarshalPostInfo

func ErrFailedToMarshalPostInfo(err error) sdk.Error

ErrFailedToMarshalPostInfo - error if marshal post info failed

func ErrFailedToMarshalPostMeta

func ErrFailedToMarshalPostMeta(err error) sdk.Error

ErrFailedToMarshalPostMeta - error if marshal post meta failed

func ErrFailedToMarshalPostReportOrUpvote

func ErrFailedToMarshalPostReportOrUpvote(err error) sdk.Error

ErrFailedToMarshalPostReportOrUpvote - error if marshal post report or upvote failed

func ErrFailedToMarshalPostView

func ErrFailedToMarshalPostView(err error) sdk.Error

ErrFailedToMarshalPostView - error if marshal post view failed

func ErrFailedToUnmarshalPostComment

func ErrFailedToUnmarshalPostComment(err error) sdk.Error

ErrFailedToUnmarshalPostComment - error if unmarshal post comment failed

func ErrFailedToUnmarshalPostDonations

func ErrFailedToUnmarshalPostDonations(err error) sdk.Error

ErrFailedToUnmarshalPostDonations - error if unmarshal post donations failed

func ErrFailedToUnmarshalPostInfo

func ErrFailedToUnmarshalPostInfo(err error) sdk.Error

ErrFailedToUnmarshalPostInfo - error if unmarshal post info failed

func ErrFailedToUnmarshalPostMeta

func ErrFailedToUnmarshalPostMeta(err error) sdk.Error

ErrFailedToUnmarshalPostMeta - error if unmarshal post meta failed

func ErrFailedToUnmarshalPostReportOrUpvote

func ErrFailedToUnmarshalPostReportOrUpvote(err error) sdk.Error

ErrFailedToUnmarshalPostReportOrUpvote - error if unmarshal post report or upvote failed

func ErrFailedToUnmarshalPostView

func ErrFailedToUnmarshalPostView(err error) sdk.Error

ErrFailedToUnmarshalPostView - error if unmarshal post view failed

func ErrPostCommentNotFound

func ErrPostCommentNotFound(key []byte) sdk.Error

ErrPostCommentNotFound - error if comment is not found in KVStore

func ErrPostDonationNotFound

func ErrPostDonationNotFound(key []byte) sdk.Error

ErrPostDonationNotFound - error if post donation is not found in KVStore

func ErrPostMetaNotFound

func ErrPostMetaNotFound(key []byte) sdk.Error

ErrPostMetaNotFound - error if post meta is not found in KVStore

func ErrPostNotFound

func ErrPostNotFound(key []byte) sdk.Error

ErrPostNotFound - error if post is not found in KVStore

func ErrPostReportOrUpvoteNotFound

func ErrPostReportOrUpvoteNotFound(key []byte) sdk.Error

ErrPostReportOrUpvoteNotFound - error if report or upvote is not found in KVStore

func ErrPostViewNotFound

func ErrPostViewNotFound(key []byte) sdk.Error

ErrPostViewNotFound - error if view is not found in KVStore

func GetPostInfoKey

func GetPostInfoKey(permlink types.Permlink) []byte

GetPostInfoKey - "post info substore" + "permlink"

func GetPostInfoPrefix added in v0.1.1

func GetPostInfoPrefix(author types.AccountKey) []byte

GetPostInfoPrefix - "post info substore" + "author"

func GetPostMetaKey

func GetPostMetaKey(permlink types.Permlink) []byte

GetPostMetaKey - "post meta substore" + "permlink"

Types

type Comment

type Comment struct {
	Author    types.AccountKey `json:"author"`
	PostID    string           `json:"post_id"`
	CreatedAt int64            `json:"created_at"`
}

Comment - comment list store dy a post

type Donations

type Donations struct {
	Username types.AccountKey `json:"username"`
	Times    int64            `json:"times"`
	Amount   types.Coin       `json:"amount"`
}

Donations - record a user donation behavior to a post

type Identifier

type Identifier string

Identifier is used to map the url in post

type PostInfo

type PostInfo struct {
	PostID       string                 `json:"post_id"`
	Title        string                 `json:"title"`
	Content      string                 `json:"content"`
	Author       types.AccountKey       `json:"author"`
	ParentAuthor types.AccountKey       `json:"parent_author"`
	ParentPostID string                 `json:"parent_postID"`
	SourceAuthor types.AccountKey       `json:"source_author"`
	SourcePostID string                 `json:"source_postID"`
	Links        []types.IDToURLMapping `json:"links"`
}

PostInfo - can also use to present comment(with parent) or repost(with source)

type PostMeta

type PostMeta struct {
	CreatedAt               int64      `json:"created_at"`
	LastUpdatedAt           int64      `json:"last_updated_at"`
	LastActivityAt          int64      `json:"last_activity_at"`
	AllowReplies            bool       `json:"allow_replies"`
	IsDeleted               bool       `json:"is_deleted"`
	TotalDonateCount        int64      `json:"total_donate_count"`
	TotalReportCoinDay      types.Coin `json:"total_report_coin_day"`
	TotalUpvoteCoinDay      types.Coin `json:"total_upvote_coin_day"`
	TotalViewCount          int64      `json:"total_view_count"`
	TotalReward             types.Coin `json:"total_reward"`
	RedistributionSplitRate sdk.Rat    `json:"redistribution_split_rate"`
}

PostMeta - stores tiny and frequently updated fields.

type PostStorage

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

PostStorage - post storage

func NewPostStorage

func NewPostStorage(key sdk.StoreKey) PostStorage

NewPostStorage - returns a new PostStorage that uses codec to (binary) encode and decode concrete Post

func (PostStorage) DoesPostExist

func (ps PostStorage) DoesPostExist(ctx sdk.Context, permlink types.Permlink) bool

DoesPostExist - check if a post exists in KVStore or not

func (PostStorage) GetPostComment

func (ps PostStorage) GetPostComment(
	ctx sdk.Context, permlink types.Permlink, commentPermlink types.Permlink) (*Comment, sdk.Error)

GetPostComment - get post comment from KVStore

func (PostStorage) GetPostDonations

func (ps PostStorage) GetPostDonations(
	ctx sdk.Context, permlink types.Permlink, donateUser types.AccountKey) (*Donations, sdk.Error)

GetPostDonations - get post donations from KVStore

func (PostStorage) GetPostInfo

func (ps PostStorage) GetPostInfo(ctx sdk.Context, permlink types.Permlink) (*PostInfo, sdk.Error)

GetPostInfo - get post info from KVStore

func (PostStorage) GetPostMeta

func (ps PostStorage) GetPostMeta(ctx sdk.Context, permlink types.Permlink) (*PostMeta, sdk.Error)

GetPostMeta - get post meta from KVStore

func (PostStorage) GetPostReportOrUpvote

func (ps PostStorage) GetPostReportOrUpvote(
	ctx sdk.Context, permlink types.Permlink, user types.AccountKey) (*ReportOrUpvote, sdk.Error)

GetPostReportOrUpvote - get report or upvote from KVStore

func (PostStorage) GetPostView

func (ps PostStorage) GetPostView(
	ctx sdk.Context, permlink types.Permlink, viewUser types.AccountKey) (*View, sdk.Error)

GetPostView - get post view from KVStore

func (PostStorage) SetPostComment

func (ps PostStorage) SetPostComment(
	ctx sdk.Context, permlink types.Permlink, postComment *Comment) sdk.Error

SetPostComment - set post comment to KVStore

func (PostStorage) SetPostDonations

func (ps PostStorage) SetPostDonations(
	ctx sdk.Context, permlink types.Permlink, postDonations *Donations) sdk.Error

SetPostDonations - set post donations to KVStore

func (PostStorage) SetPostInfo

func (ps PostStorage) SetPostInfo(ctx sdk.Context, postInfo *PostInfo) sdk.Error

SetPostInfo - set post info to KVStore

func (PostStorage) SetPostMeta

func (ps PostStorage) SetPostMeta(ctx sdk.Context, permlink types.Permlink, postMeta *PostMeta) sdk.Error

SetPostMeta - set post meta to KVStore

func (PostStorage) SetPostReportOrUpvote

func (ps PostStorage) SetPostReportOrUpvote(
	ctx sdk.Context, permlink types.Permlink, reportOrUpvote *ReportOrUpvote) sdk.Error

SetPostReportOrUpvote - set report or upvote to KVStore

func (PostStorage) SetPostView

func (ps PostStorage) SetPostView(ctx sdk.Context, permlink types.Permlink, postView *View) sdk.Error

SetPostView - set post view to KVStore

type ReportOrUpvote

type ReportOrUpvote struct {
	Username  types.AccountKey `json:"username"`
	CoinDay   types.Coin       `json:"coin_day"`
	CreatedAt int64            `json:"created_at"`
	IsReport  bool             `json:"is_report"`
}

ReportOrUpvote - report or upvote from a user to a post

type URL

type URL string

URL used to link resources such as vedio, text or photo

type View

type View struct {
	Username   types.AccountKey `json:"username"`
	LastViewAt int64            `json:"last_view_at"`
	Times      int64            `jons:"times"`
}

View - from a user to a post

Jump to

Keyboard shortcuts

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