models

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName       = common.ModuleName
	RouterKey        = common.RouterKey
	StoreKey         = common.StoreKey
	ActionReportPost = common.ActionReportPost
	QuerierRoute     = common.QuerierRoute
	QueryReports     = common.QueryReports
)

Variables

View Source
var (
	// variable aliases
	ReportsStorePrefix     = common.ReportsStorePrefix
	ReportsTypeStorePrefix = common.ReportsTypeStorePrefix
)
View Source
var ModelsCdc = codec.New()

ModelsCdc is the codec

Functions

func RegisterModelsCodec

func RegisterModelsCodec(cdc *codec.Codec)

RegisterModelsCodec registers concrete types on the Amino codec

func ReportStoreKey

func ReportStoreKey(id posts.PostID) []byte

ReportsStoreKey turn an id to a key used to store a reports inside the reports store

Types

type Report

type Report struct {
	Type    string         `json:"type" yaml:"type"`       // Identifies the type of the reports
	Message string         `json:"message" yaml:"message"` // Contains the user message
	User    sdk.AccAddress `json:"user" yaml:"user"`       // Identifies the reporting user
}

Report is the struct of a post's reports

func NewReport

func NewReport(t string, message string, user sdk.AccAddress) Report

NewReport returns a Report

func (Report) Validate

func (r Report) Validate() error

Validate implements validator

type Reports

type Reports []Report

func (Reports) String

func (reports Reports) String() string

String implements stringer

func (Reports) Validate

func (reports Reports) Validate() error

Validate implements validator

type ReportsQueryResponse

type ReportsQueryResponse struct {
	PostID  posts.PostID `json:"post_id" yaml:"post_id"`
	Reports `json:"reports" yaml:"reports"`
}

func NewReportResponse

func NewReportResponse(postID posts.PostID, reports Reports) ReportsQueryResponse

func (ReportsQueryResponse) MarshalJSON

func (response ReportsQueryResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler as Amino does not respect default json composition

func (ReportsQueryResponse) String

func (response ReportsQueryResponse) String() string

String implements fmt.Stringer

func (*ReportsQueryResponse) UnmarshalJSON

func (response *ReportsQueryResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler as Amino does not respect default json composition

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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