types

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName               = common.ModuleName
	RouterKey                = common.RouterKey
	StoreKey                 = common.StoreKey
	ActionCreatePost         = common.ActionCreatePost
	ActionEditPost           = common.ActionEditPost
	ActionAnswerPoll         = common.ActionAnswerPoll
	ActionAddPostReaction    = common.ActionAddPostReaction
	ActionRemovePostReaction = common.ActionRemovePostReaction
	ActionRegisterReaction   = common.ActionRegisterReaction
	QuerierRoute             = common.QuerierRoute
	QueryPost                = common.QueryPost
	QueryPosts               = common.QueryPosts
	QueryPollAnswers         = common.QueryPollAnswers
	QueryRegisteredReactions = common.QueryRegisteredReactions
	QueryParams              = common.QueryParams
	PostSortByCreationDate   = common.PostSortByCreationDate
	PostSortByID             = common.PostSortByID
	PostSortOrderAscending   = common.PostSortOrderAscending
	PostSortOrderDescending  = common.PostSortOrderDescending
)
View Source
const (
	EventTypePostCreated         = "post_created"
	EventTypePostEdited          = "post_edited"
	EventTypePostReactionAdded   = "post_reaction_added"
	EventTypePostReactionRemoved = "post_reaction_removed"
	EventTypeAnsweredPoll        = "post_poll_answered"
	EventTypeClosePoll           = "post_poll_closed"
	EventTypeRegisterReaction    = "reaction_registered"

	// Post attributes
	AttributeKeyPostID           = "post_id"
	AttributeKeyPostParentID     = "post_parent_id"
	AttributeKeyPostOwner        = "post_owner"
	AttributeKeyPostEditTime     = "post_edit_time"
	AttributeKeyPostCreationTime = "post_creation_time"

	// Poll attributes
	AttributeKeyPollAnswerer = "poll_answerer"

	// PostReaction attributes
	AttributeKeyPostReactionOwner = "reaction_user"
	AttributeKeyPostReactionValue = "reaction_value"
	AttributeKeyReactionShortCode = "reaction_shortcode"

	// Reaction attributes
	AttributeKeyReactionCreator  = "reaction_creator"
	AttributeKeyReactionSubSpace = "reaction_subspace"
)

Posts module event types

View Source
const (
	// default paramspace for paramsModule keeper
	DefaultParamspace = ModuleName
)

Variables

View Source
var (
	// functions aliases
	NewPostReaction            = reactions.NewPostReaction
	NewPostReactions           = reactions.NewPostReactions
	NewReaction                = reactions.NewReaction
	IsEmoji                    = reactions.IsEmoji
	NewReactions               = reactions.NewReactions
	NewMsgAnswerPoll           = msgs.NewMsgAnswerPoll
	NewMsgCreatePost           = msgs.NewMsgCreatePost
	NewMsgEditPost             = msgs.NewMsgEditPost
	NewMsgRegisterReaction     = msgs.NewMsgRegisterReaction
	RegisterMessagesCodec      = msgs.RegisterMessagesCodec
	NewMsgAddPostReaction      = msgs.NewMsgAddPostReaction
	NewMsgRemovePostReaction   = msgs.NewMsgRemovePostReaction
	RegisterModelsCodec        = models.RegisterModelsCodec
	ParsePostID                = models.ParsePostID
	NewPost                    = models.NewPost
	NewPostResponse            = models.NewPostResponse
	PostStoreKey               = models.PostStoreKey
	PostIndexedIDStoreKey      = models.PostIndexedIDStoreKey
	PostCommentsStoreKey       = models.PostCommentsStoreKey
	PostReactionsStoreKey      = models.PostReactionsStoreKey
	ReactionsStoreKey          = models.ReactionsStoreKey
	PollAnswersStoreKey        = models.PollAnswersStoreKey
	IsValidPostID              = common.IsValidPostID
	IsValidReactionCode        = common.IsValidReactionCode
	GetEmojiByShortCodeOrValue = common.GetEmojiByShortCodeOrValue
	NewAttachment              = common.NewAttachment
	NewAttachments             = common.NewAttachments
	ParseAnswerID              = polls.ParseAnswerID
	NewPollAnswer              = polls.NewPollAnswer
	NewPollAnswers             = polls.NewPollAnswers
	NewPollData                = polls.NewPollData
	ArePollDataEquals          = polls.ArePollDataEquals
	NewUserAnswer              = polls.NewUserAnswer
	NewUserAnswers             = polls.NewUserAnswers

	// variable aliases
	ModelsCdc                = models.ModelsCdc
	ModuleAddress            = common.ModuleAddress
	PostStorePrefix          = common.PostStorePrefix
	PostIndexedIDStorePrefix = common.PostIndexedIDStorePrefix
	PostTotalNumberPrefix    = common.PostTotalNumberPrefix
	PostCommentsStorePrefix  = common.PostCommentsStorePrefix
	PostReactionsStorePrefix = common.PostReactionsStorePrefix
	ReactionsStorePrefix     = common.ReactionsStorePrefix
	PollAnswersStorePrefix   = common.PollAnswersStorePrefix
	MsgsCodec                = msgs.MsgsCodec
)
View Source
var (
	DefaultMaxPostMessageLength            = sdk.NewInt(500)
	DefaultMaxOptionalDataFieldsNumber     = sdk.NewInt(10)
	DefaultMaxOptionalDataFieldValueLength = sdk.NewInt(200)
)

Default posts params

View Source
var (
	MaxPostMessageLengthKey            = []byte("MaxPostMessageLength")
	MaxOptionalDataFieldsNumberKey     = []byte("MaxOptionalDataFieldsNumber")
	MaxOptionalDataFieldValueLengthKey = []byte("MaxOptionalDataFieldValueLength")
)

Parameters store keys

View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec used inside the whole posts module

Functions

func ParamKeyTable

func ParamKeyTable() paramsModule.KeyTable

ParamKeyTable Key declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the given genesis state and returns an error if something is invalid

func ValidateMaxOptionalDataFieldNumberParam

func ValidateMaxOptionalDataFieldNumberParam(i interface{}) error

func ValidateMaxOptionalDataFieldValueLengthParam

func ValidateMaxOptionalDataFieldValueLengthParam(i interface{}) error

func ValidateMaxPostMessageLengthParam

func ValidateMaxPostMessageLengthParam(i interface{}) error

Types

type AnswerID

type AnswerID = polls.AnswerID

type Attachment added in v0.10.0

type Attachment = common.Attachment

type Attachments added in v0.10.0

type Attachments = common.Attachments

type GenesisState

type GenesisState struct {
	Posts               Posts                    `json:"posts"`
	UsersPollAnswers    map[string]UserAnswers   `json:"users_poll_answers"`
	PostReactions       map[string]PostReactions `json:"post_reactions"`
	RegisteredReactions Reactions                `json:"registered_reactions"`
	Params              Params                   `json:"params"`
}

GenesisState contains the data of the genesis state for the posts module

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default GenesisState

func NewGenesisState

func NewGenesisState(posts Posts, postReactions map[string]PostReactions, registeredR Reactions, params Params) GenesisState

NewGenesisState creates a new genesis state

type KeyValue

type KeyValue = common.KeyValue

type MsgAddPostReaction

type MsgAddPostReaction = msgs.MsgAddPostReaction

type MsgAnswerPoll

type MsgAnswerPoll = msgs.MsgAnswerPoll

type MsgCreatePost

type MsgCreatePost = msgs.MsgCreatePost

type MsgEditPost

type MsgEditPost = msgs.MsgEditPost

type MsgRegisterReaction

type MsgRegisterReaction = msgs.MsgRegisterReaction

type MsgRemovePostReaction

type MsgRemovePostReaction = msgs.MsgRemovePostReaction

type OptionalData

type OptionalData = common.OptionalData

type Params

type Params struct {
	MaxPostMessageLength            sdk.Int `json:"max_post_message_length" yaml:"max_post_message_length"`
	MaxOptionalDataFieldsNumber     sdk.Int `json:"max_optional_data_fields_number" yaml:"max_optional_data_fields_number"`
	MaxOptionalDataFieldValueLength sdk.Int `json:"max_optional_data_field_value_length" yaml:"max_optional_data_field_value_length"`
}

func DefaultParams

func DefaultParams() Params

DefaultParams return default params object

func NewParams

func NewParams(maxPostMLen, maxOpDataFieldNum, maxOpDataFieldValLen sdk.Int) Params

NewParams creates a new Params obj

func (*Params) ParamSetPairs

func (params *Params) ParamSetPairs() paramsModule.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns the key/value pairs of posts module's parameters.

func (Params) String

func (params Params) String() string

String implements Stringer

func (Params) Validate

func (params Params) Validate() error

Validate perform basic checks on all parameters to ensure they are correct

type PollAnswer

type PollAnswer = polls.PollAnswer

type PollAnswers

type PollAnswers = polls.PollAnswers

type PollAnswersQueryResponse

type PollAnswersQueryResponse = models.PollAnswersQueryResponse

type PollData

type PollData = polls.PollData

type Post

type Post = models.Post

type PostID

type PostID = models.PostID

type PostIDs

type PostIDs = models.PostIDs

type PostQueryResponse

type PostQueryResponse = models.PostQueryResponse

type PostReaction

type PostReaction = reactions.PostReaction

type PostReactions

type PostReactions = reactions.PostReactions

type Posts

type Posts = models.Posts

type QueryPostsParams

type QueryPostsParams struct {
	Page  int
	Limit int

	SortBy    string // Field that should determine the sorting
	SortOrder string // Either ascending or descending

	ParentID       *PostID
	CreationTime   *time.Time
	AllowsComments *bool
	Subspace       string
	Creator        sdk.AccAddress
	Hashtags       []string
}

QueryPostsParams Params for query 'custom/posts/posts'

func DefaultQueryPostsParams

func DefaultQueryPostsParams(page, limit int) QueryPostsParams

type Reaction

type Reaction = reactions.Reaction

type Reactions

type Reactions = reactions.Reactions

type UserAnswer

type UserAnswer = polls.UserAnswer

type UserAnswers

type UserAnswers = polls.UserAnswers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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