models

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "relationships"
	RouterKey  = ModuleName
	StoreKey   = ModuleName

	ActionCreateRelationship = "create_relationship"
	ActionDeleteRelationship = "delete_relationship"
	ActionBlockUser          = "block_user"
	ActionUnblockUser        = "unblock_user"

	// Queries
	QuerierRoute           = ModuleName
	QueryUserRelationships = "user_relationships"
	QueryRelationships     = "relationships"
	QueryUserBlocks        = "user_blocks"
)

Variables

View Source
var (
	RelationshipsStorePrefix = []byte("relationships")
	UsersBlocksStorePrefix   = []byte("users_blocks")
)
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 RelationshipsStoreKey

func RelationshipsStoreKey(user sdk.AccAddress) []byte

RelationshipsStoreKey turns a user address to a key used to store a Address -> []Address couple

func UsersBlocksStoreKey added in v0.12.0

func UsersBlocksStoreKey(user sdk.AccAddress) []byte

UsersBlocksStoreKey turns a user address to a key used to store a Address -> []Address couple

Types

type Relationship added in v0.12.0

type Relationship struct {
	Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
	Subspace  string         `json:"subspace" yaml:"subspace"`
}

Relationship is the struct of a relationship. It represent the concept of "follow" of traditional social networks.

func NewRelationship added in v0.12.0

func NewRelationship(recipient sdk.AccAddress, subspace string) Relationship

func (Relationship) Equals added in v0.12.0

func (r Relationship) Equals(other Relationship) bool

Equals allows to check whether the contents of r are the same of other

func (Relationship) String added in v0.12.0

func (r Relationship) String() string

String implement fmt.Stringer

func (Relationship) Validate added in v0.12.0

func (r Relationship) Validate() error

Validate implement Validator

type Relationships added in v0.12.0

type Relationships []Relationship

func (Relationships) String added in v0.12.0

func (rs Relationships) String() string

String implement fmt.Stringer

type UserBlock added in v0.12.0

type UserBlock struct {
	Blocker  sdk.AccAddress `json:"blocker" yaml:"blocker"`
	Blocked  sdk.AccAddress `json:"blocked" yaml:"blocked"`
	Reason   string         `json:"reason,omitempty" yaml:"reason,omitempty"`
	Subspace string         `json:"subspace" yaml:"subspace"`
}

UserBlock represents the fact that the Blocker has blocked the given Blocked user. The Reason field represents the reason the user has been blocked for, and is optional.

func NewUserBlock added in v0.12.0

func NewUserBlock(blocker, blocked sdk.AccAddress, reason, subspace string) UserBlock

func (UserBlock) Equals added in v0.12.0

func (ub UserBlock) Equals(other UserBlock) bool

Equals checks if the two user blocks have the same content

func (UserBlock) String added in v0.12.0

func (ub UserBlock) String() string

String implements fmt.Stringer

func (UserBlock) Validate added in v0.12.0

func (ub UserBlock) Validate() error

Validate implements validator

Jump to

Keyboard shortcuts

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