Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
- func ValidCommentsDateInvariant(k Keeper) sdk.Invariant
- func ValidPollForPollAnswersInvariant(k Keeper) sdk.Invariant
- func ValidPostForReactionsInvariant(k Keeper) sdk.Invariant
- func ValidPostsInvariant(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) GetPollAnswers(ctx sdk.Context, postID types.PostID) types.UserAnswers
- func (k Keeper) GetPollAnswersByUser(ctx sdk.Context, postID types.PostID, user sdk.AccAddress) []types.AnswerID
- func (k Keeper) GetPollAnswersMap(ctx sdk.Context) map[string]types.UserAnswers
- func (k Keeper) GetPost(ctx sdk.Context, id types.PostID) (post types.Post, found bool)
- func (k Keeper) GetPostChildrenIDs(ctx sdk.Context, postID types.PostID) types.PostIDs
- func (k Keeper) GetPostReactions(ctx sdk.Context, postID types.PostID) types.PostReactions
- func (k Keeper) GetPosts(ctx sdk.Context) (posts types.Posts)
- func (k Keeper) GetPostsFiltered(ctx sdk.Context, params types.QueryPostsParams) types.Posts
- func (k Keeper) GetReactions(ctx sdk.Context) map[string]types.PostReactions
- func (k Keeper) GetRegisteredReaction(ctx sdk.Context, shortcode string, subspace string) (reaction types.Reaction, exist bool)
- func (k Keeper) GetRegisteredReactions(ctx sdk.Context) (reactions types.Reactions)
- func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Post) (stop bool))
- func (k Keeper) RegisterReaction(ctx sdk.Context, reaction types.Reaction)
- func (k Keeper) RemovePostReaction(ctx sdk.Context, postID types.PostID, reaction types.PostReaction) error
- func (k Keeper) SavePollAnswers(ctx sdk.Context, postID types.PostID, userPollAnswers types.UserAnswer)
- func (k Keeper) SavePost(ctx sdk.Context, post types.Post)
- func (k Keeper) SavePostReaction(ctx sdk.Context, postID types.PostID, reaction types.PostReaction) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶ added in v0.5.0
AllInvariants runs all invariants of the module
func NewHandler ¶
NewHandler returns a handler for "magpie" type messages.
func NewQuerier ¶
NewQuerier is the module level router for state queries
func RegisterInvariants ¶ added in v0.5.0
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
RegisterInvariants registers all posts invariants
func ValidCommentsDateInvariant ¶ added in v0.5.0
ValidCommentsDateInvariant checks that comments creation date is always greater than parent creation date
func ValidPollForPollAnswersInvariant ¶ added in v0.5.0
ValidPollForPollAnswersInvariant check that the poll answers are referred to a valid post's poll
func ValidPostForReactionsInvariant ¶ added in v0.5.0
ValidPostForReactionsInvariant checks that the post related to the reactions is valid and exists
func ValidPostsInvariant ¶ added in v0.5.0
ValidPostsInvariant checks that the all posts are valid
Types ¶
type Keeper ¶
type Keeper struct { StoreKey sdk.StoreKey // Unexposed key to access store from sdk.Context Cdc *codec.Codec // The wire codec for binary encoding/decoding. }
Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
func (Keeper) GetPollAnswers ¶ added in v0.3.0
GetPollAnswers returns the list of all the post polls answers associated with the given postID that are stored into the current state.
func (Keeper) GetPollAnswersByUser ¶ added in v0.3.0
func (k Keeper) GetPollAnswersByUser(ctx sdk.Context, postID types.PostID, user sdk.AccAddress) []types.AnswerID
GetPollAnswersByUser retrieves post poll answers associated to the given ID and filtered by user
func (Keeper) GetPollAnswersMap ¶ added in v0.3.0
GetPollAnswersMap allows to returns the list of answers that have been stored inside the given context
func (Keeper) GetPost ¶
GetPost returns the post having the given id inside the current context. If no post having the given id can be found inside the current context, false will be returned.
func (Keeper) GetPostChildrenIDs ¶
GetPostChildrenIDs returns the IDs of all the children posts associated to the post having the given postID nolint: interfacer
func (Keeper) GetPostReactions ¶ added in v0.2.0
GetPostReactions returns the list of reactions that has been associated to the post having the given id nolint: interfacer
func (Keeper) GetPosts ¶
GetPosts returns the list of all the posts that are stored into the current state.
func (Keeper) GetPostsFiltered ¶ added in v0.2.0
GetPostsFiltered retrieves posts filtered by a given set of params which include pagination parameters along with the creator address, the parent id and the creation time.
NOTE: If no filters are provided, all posts will be returned in paginated form.
func (Keeper) GetReactions ¶ added in v0.2.0
GetReactions allows to returns the list of reactions that have been stored inside the given context
func (Keeper) GetRegisteredReaction ¶ added in v0.4.0
func (k Keeper) GetRegisteredReaction( ctx sdk.Context, shortcode string, subspace string, ) (reaction types.Reaction, exist bool)
GetRegisteredReaction returns the registered reaction which has the given shortcode and is registered to be used inside the given subspace. If no reaction could be found, returns false instead.
func (Keeper) GetRegisteredReactions ¶ added in v0.4.0
GetRegisteredReactions returns all the registered reactions
func (Keeper) IteratePosts ¶ added in v0.3.0
IteratePosts iterates through the posts set and performs the provided function
func (Keeper) RegisterReaction ¶ added in v0.4.0
RegisterReaction allows to register a new reaction for later reference
func (Keeper) RemovePostReaction ¶ added in v0.4.0
func (k Keeper) RemovePostReaction(ctx sdk.Context, postID types.PostID, reaction types.PostReaction) error
RemovePostReaction removes the reaction from the given user from the post having the given postID. If no reaction with the same value was previously added from the given user, an expError is returned. nolint: interfacer
func (Keeper) SavePollAnswers ¶ added in v0.3.0
func (k Keeper) SavePollAnswers(ctx sdk.Context, postID types.PostID, userPollAnswers types.UserAnswer)
SavePollAnswers save the poll's answers associated with the given postID inside the current context It assumes that the post exists and has a Poll inside it. If userAnswersDetails are already present, the old ones will be overridden.
func (Keeper) SavePost ¶
SavePost allows to save the given post inside the current context. It assumes that the given post has already been validated. If another post has the same ID of the given post, the old post will be overridden
func (Keeper) SavePostReaction ¶ added in v0.4.0
func (k Keeper) SavePostReaction(ctx sdk.Context, postID types.PostID, reaction types.PostReaction) error
SavePostReaction allows to save the given reaction inside the store. It assumes that the given reaction is valid and already registered. If another reaction from the same user for the same post and with the same value exists, returns an expError. nolint: interfacer