model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrFailedToMarshalPostComment

func ErrFailedToMarshalPostComment(err error) sdk.Error

func ErrFailedToMarshalPostDonations

func ErrFailedToMarshalPostDonations(err error) sdk.Error

func ErrFailedToMarshalPostInfo

func ErrFailedToMarshalPostInfo(err error) sdk.Error

marshal error

func ErrFailedToMarshalPostMeta

func ErrFailedToMarshalPostMeta(err error) sdk.Error

func ErrFailedToMarshalPostReportOrUpvote

func ErrFailedToMarshalPostReportOrUpvote(err error) sdk.Error

func ErrFailedToMarshalPostView

func ErrFailedToMarshalPostView(err error) sdk.Error

func ErrFailedToUnmarshalPostComment

func ErrFailedToUnmarshalPostComment(err error) sdk.Error

func ErrFailedToUnmarshalPostDonations

func ErrFailedToUnmarshalPostDonations(err error) sdk.Error

func ErrFailedToUnmarshalPostInfo

func ErrFailedToUnmarshalPostInfo(err error) sdk.Error

unmarshal error

func ErrFailedToUnmarshalPostMeta

func ErrFailedToUnmarshalPostMeta(err error) sdk.Error

func ErrFailedToUnmarshalPostReportOrUpvote

func ErrFailedToUnmarshalPostReportOrUpvote(err error) sdk.Error

func ErrFailedToUnmarshalPostView

func ErrFailedToUnmarshalPostView(err error) sdk.Error

func ErrPostCommentNotFound

func ErrPostCommentNotFound(key []byte) sdk.Error

func ErrPostDonationNotFound

func ErrPostDonationNotFound(key []byte) sdk.Error

func ErrPostMetaNotFound

func ErrPostMetaNotFound(key []byte) sdk.Error

func ErrPostNotFound

func ErrPostNotFound(key []byte) sdk.Error

not found error

func ErrPostReportOrUpvoteNotFound

func ErrPostReportOrUpvoteNotFound(key []byte) sdk.Error

func ErrPostViewNotFound

func ErrPostViewNotFound(key []byte) sdk.Error

func GetPostInfoKey

func GetPostInfoKey(permlink types.Permlink) []byte

func GetPostMetaKey

func GetPostMetaKey(permlink types.Permlink) []byte

Types

type Comment

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

type Comments

type Comments []Comment

type Donations

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

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"`
	TotalReportStake        types.Coin `json:"total_report_stake"`
	TotalUpvoteStake        types.Coin `json:"total_upvote_stake"`
	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
}

func NewPostStorage

func NewPostStorage(key sdk.StoreKey) PostStorage

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

func (PostStorage) DoesPostExist

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

func (PostStorage) GetPostComment

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

func (PostStorage) GetPostDonations

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

func (PostStorage) GetPostInfo

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

func (PostStorage) GetPostMeta

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

func (PostStorage) GetPostReportOrUpvote

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

func (PostStorage) GetPostView

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

func (PostStorage) SetPostComment

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

func (PostStorage) SetPostDonations

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

func (PostStorage) SetPostInfo

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

func (PostStorage) SetPostMeta

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

func (PostStorage) SetPostReportOrUpvote

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

func (PostStorage) SetPostView

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

type ReportOrUpvote

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

ReportOrUpvote struct, only used in ReportOrUpvotes

type ReportOrUpvotes

type ReportOrUpvotes []ReportOrUpvote

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 struct

Jump to

Keyboard shortcuts

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