example

package module
v0.0.0-...-5203e0d Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ADD_USER = "AddUser"

ADD_USER Action name

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Street string
	City   string
}

Address ...

type User

type User struct {
	Name, ID string
	Age      int
	Address  Address
	Tags     []string
}

User ..

func CreateNewUser

func CreateNewUser() User

CreateNewUser creates a random user

type UserState

type UserState struct {
	Users      map[string]User
	SelectedID string
	Cities     []string
}

UserState ...

type UserStore

type UserStore struct {
	*kirax.Store
}

UserStore custom store

func NewUserStore

func NewUserStore(users map[string]User) *UserStore

NewUserStore creates new store

func (*UserStore) AddUser

func (u *UserStore) AddUser(user User) error

AddUser invokes dipatch action ADD_USER

func (*UserStore) GetState

func (u *UserStore) GetState() (UserState, error)

GetState casts UserState type

func (*UserStore) InitStore

func (u *UserStore) InitStore() error

InitStore initializes the store with listeners and modifiers

Jump to

Keyboard shortcuts

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