src

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPersonNotFound is returned when the object is not found.
	ErrPersonNotFound = errors.New("src: Person not found")
	// ErrPersonAlreadyExists is returned when the object already exists.
	ErrPersonAlreadyExists = errors.New("src: Person already exists")
)
View Source
var (
	ErrUnknownRequest = errors.New("unknown request")
)
View Source
var (
	// PersonState provides access to the Person namespaced storage.
	PersonState = PersonStateHandler{/* contains filtered or unexported fields */}
)

Functions

func Execute

func Execute(deps *std.Deps, _ types.Env, messageInfo types.MessageInfo, messageBytes []byte) (*types.Response, error)

func Instantiate

func Instantiate(_ *std.Deps, _ types.Env, _ types.MessageInfo, _ []byte) (*types.Response, error)

func Migrate

func Migrate(_ *std.Deps, _ types.Env, _ []byte) (*types.Response, error)

func Query

func Query(deps *std.Deps, env types.Env, messageBytes []byte) ([]byte, error)

Types

type ExecuteMsg

type ExecuteMsg struct {
	CreateIdentity *MsgCreateIdentity `json:"create_identity"`
	UpdateCity     *MsgUpdateCity     `json:"update_city"`
	DeleteIdentity *MsgDelete         `json:"delete_identity"`
}

ExecuteMsg is used to execute state transitions on the identity contract

func (ExecuteMsg) MarshalJSON

func (v ExecuteMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (ExecuteMsg) MarshalTinyJSON

func (v ExecuteMsg) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*ExecuteMsg) UnmarshalJSON

func (v *ExecuteMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ExecuteMsg) UnmarshalTinyJSON

func (v *ExecuteMsg) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type MsgCreateIdentity

type MsgCreateIdentity struct {
	Name       string `json:"name"`
	Surname    string `json:"surname"`
	City       string `json:"city"`
	PostalCode int32  `json:"postal_code"`
}

func (MsgCreateIdentity) MarshalJSON

func (v MsgCreateIdentity) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (MsgCreateIdentity) MarshalTinyJSON

func (v MsgCreateIdentity) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*MsgCreateIdentity) UnmarshalJSON

func (v *MsgCreateIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*MsgCreateIdentity) UnmarshalTinyJSON

func (v *MsgCreateIdentity) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type MsgDelete

type MsgDelete struct {
}

func (MsgDelete) MarshalJSON

func (v MsgDelete) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (MsgDelete) MarshalTinyJSON

func (v MsgDelete) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*MsgDelete) UnmarshalJSON

func (v *MsgDelete) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*MsgDelete) UnmarshalTinyJSON

func (v *MsgDelete) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type MsgUpdateCity

type MsgUpdateCity struct {
	City       string `json:"city"`
	PostalCode int32  `json:"postal_code"`
}

func (MsgUpdateCity) MarshalJSON

func (v MsgUpdateCity) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (MsgUpdateCity) MarshalTinyJSON

func (v MsgUpdateCity) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*MsgUpdateCity) UnmarshalJSON

func (v *MsgUpdateCity) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*MsgUpdateCity) UnmarshalTinyJSON

func (v *MsgUpdateCity) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type Person

type Person struct {
	Address    string `json:"address" orm:"primaryKey"`
	Name       string
	Surname    string
	City       string
	PostalCode int32
}

Person keeps track of the real identity of an address

func (Person) MarshalJSON

func (v Person) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Person) MarshalTinyJSON

func (v Person) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*Person) UnmarshalJSON

func (v *Person) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Person) UnmarshalTinyJSON

func (v *Person) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type PersonStateHandler

type PersonStateHandler struct {
	// contains filtered or unexported fields
}

PersonStateHandler provides ORM functionality around Person.

func (PersonStateHandler) Create

func (x PersonStateHandler) Create(storage std.Storage, o Person) error

Create handles creation of Person objects. Returns ErrPersonAlreadyExists in case the object exists.

func (PersonStateHandler) Delete

func (x PersonStateHandler) Delete(storage std.Storage, o Person) error

Delete deletes an instance of Person given its Address. Returns ErrPersonNotFound in case no record is found.

func (PersonStateHandler) Read

func (x PersonStateHandler) Read(storage std.Storage, address string) (Person, error)

Read returns Person given its Address. Returns ErrPersonNotFound in case nothing is found.

func (PersonStateHandler) Update

func (x PersonStateHandler) Update(storage std.Storage, address string, f func(old *Person) (*Person, error)) (err error)

Update updates an instance of Person, given its Address by running the provided function f. If f passes a nil Person it means the object was not found. Returning a nil Person from f will cause no updates in the object.

type QueryIdentity

type QueryIdentity struct {
	ID string `json:"id"`
}

func (QueryIdentity) MarshalJSON

func (v QueryIdentity) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (QueryIdentity) MarshalTinyJSON

func (v QueryIdentity) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*QueryIdentity) UnmarshalJSON

func (v *QueryIdentity) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*QueryIdentity) UnmarshalTinyJSON

func (v *QueryIdentity) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type QueryMsg

type QueryMsg struct {
	Identity *QueryIdentity `json:"identity"`
}

func (QueryMsg) MarshalJSON

func (v QueryMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (QueryMsg) MarshalTinyJSON

func (v QueryMsg) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*QueryMsg) UnmarshalJSON

func (v *QueryMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*QueryMsg) UnmarshalTinyJSON

func (v *QueryMsg) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

Jump to

Keyboard shortcuts

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