v020

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ModuleName = "posts"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GenesisState

type GenesisState struct {
	Posts     []Post                `json:"posts"`
	Reactions map[string][]Reaction `json:"reactions"`
}

GenesisState contains the data of a v0.2.0 genesis state for the posts module

func Migrate

func Migrate(oldGenState v010posts.GenesisState, genesisTime time.Time, blockInterval int) GenesisState

Migrate accepts exported genesis state from v0.1.0 and migrates it to v0.2.0 genesis state. This migration changes the data that are saved for each post moving the external reference into the arbitrary data map and adding the new subspace field

type OptionalData

type OptionalData map[string]string

type Post

type Post struct {
	PostID         PostID         `json:"id"`                      // Unique id
	ParentID       PostID         `json:"parent_id"`               // Post of which this one is a comment
	Message        string         `json:"message"`                 // Message contained inside the post
	Created        time.Time      `json:"created"`                 // RFC3339 date at which the post has been created
	LastEdited     time.Time      `json:"last_edited"`             // RFC3339 date at which the post has been edited the last time
	AllowsComments bool           `json:"allows_comments"`         // Tells if users can reference this PostID as the parent
	Subspace       string         `json:"subspace"`                // Identifies the application that has posted the message
	OptionalData   OptionalData   `json:"optional_data,omitempty"` // Arbitrary data that can be used from the developers
	Creator        sdk.AccAddress `json:"creator"`                 // Creator of the Post
}

Post is a struct of a post

func (Post) ConflictsWith added in v0.3.0

func (p Post) ConflictsWith(other Post) bool

func (Post) ContentsEquals added in v0.3.0

func (p Post) ContentsEquals(other Post) bool

ContentsEquals returns true if and only if p and other contain the same data, without considering the ID

type PostID

type PostID uint64

PostID represents a unique post id

func (PostID) String added in v0.3.0

func (id PostID) String() string

String implements fmt.Stringer

type Reaction

type Reaction struct {
	Owner sdk.AccAddress `json:"owner"` // User that has created the reaction
	Value string         `json:"value"` // Reaction of the reaction
}

Reaction is a struct of a user reaction to a post

Jump to

Keyboard shortcuts

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