Documentation ¶
Index ¶
- Constants
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- type Keeper
- func (k Keeper) GetLastPostID(ctx sdk.Context) types.PostID
- func (k Keeper) GetLikes(ctx sdk.Context) map[types.PostID]types.Likes
- 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) GetPostLikes(ctx sdk.Context, postID types.PostID) types.Likes
- func (k Keeper) GetPosts(ctx sdk.Context) []types.Post
- func (k Keeper) RemoveLike(ctx sdk.Context, postID types.PostID, liker sdk.AccAddress) sdk.Error
- func (k Keeper) SaveLike(ctx sdk.Context, postID types.PostID, like types.Like) sdk.Error
- func (k Keeper) SavePost(ctx sdk.Context, post types.Post)
- type PostQueryResponse
Constants ¶
const (
QueryPost = "post"
)
query endpoints supported by the magpie Querier
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler returns a handler for "magpie" type messages.
func NewQuerier ¶
NewQuerier is the module level router for state queries
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) GetLastPostID ¶
GetLastPostID returns the last post id that has been used
func (Keeper) GetLikes ¶
GetLikes allows to returns the list of likes 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) GetPostLikes ¶
GetPostLikes returns the list of likes 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) RemoveLike ¶
RemoveLike removes the liker from the given liker from the post having the given postID. If no liker was previously added from the given liker, an error is returned. nolint: interfacer
type PostQueryResponse ¶
type PostQueryResponse struct { types.Post Likes types.Likes `json:"likes"` Children types.PostIDs `json:"children"` }
PostQueryResponse represents the data of a post that is returned to user upon a query
func NewPostResponse ¶
func (PostQueryResponse) MarshalJSON ¶
func (response PostQueryResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler as Amino does not respect default json composition