model

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthorPrefix added in v0.3.0

func GetAuthorPrefix(author linotypes.AccountKey) []byte

func GetPostInfoKey

func GetPostInfoKey(permlink linotypes.Permlink) []byte

GetPostInfoKey - "post info substore" + "permlink"

Types

type Post added in v0.3.0

type Post struct {
	PostID    string           `json:"post_id"`
	Title     string           `json:"title"`
	Content   string           `json:"content"`
	Author    types.AccountKey `json:"author"`
	CreatedBy types.AccountKey `json:"created_by"`
	CreatedAt int64            `json:"created_at"`
	UpdatedAt int64            `json:"updated_at"`
	IsDeleted bool             `json:"is_deleted"`
}

Post - post is created by the CreatedBy.

type PostInfoV1 added in v0.3.0

type PostInfoV1 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"`
}

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

type PostMetaIR added in v0.2.0

type PostMetaIR 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 string     `json:"redistribution_split_rate"`
}

PostMetaIR RedistributionSplitRate rat -> string

type PostRowIR added in v0.2.0

type PostRowIR struct {
	Permlink types.Permlink `json:"permlink"`
	Info     PostInfoV1     `json:"info"`
	Meta     PostMetaIR     `json:"meta"`
}

PostRowIR - Meta changed

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) Export added in v0.2.0

func (ps PostStorage) Export(ctx sdk.Context) *PostTablesIR

// Export post storage state.

func (PostStorage) GetPost added in v0.3.0

func (ps PostStorage) GetPost(ctx sdk.Context, permlink linotypes.Permlink) (*Post, sdk.Error)

GetPostInfo - get post info from KVStore

func (PostStorage) HasPost added in v0.3.0

func (ps PostStorage) HasPost(ctx sdk.Context, permlink linotypes.Permlink) bool

DoesPostExist - check if a post exists in KVStore or not

func (PostStorage) SetPost added in v0.3.0

func (ps PostStorage) SetPost(ctx sdk.Context, postInfo *Post)

SetPostInfo - set post info to KVStore

type PostTablesIR added in v0.2.0

type PostTablesIR struct {
	Posts []PostRowIR `json:"posts"`
}

PostTablesIR - PostRow changed.

Jump to

Keyboard shortcuts

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