state

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(con *sql.DB, botID int64) *DB

func (*DB) Load

func (db *DB) Load(ctx context.Context, uid types.ChatID, state types.State) error

func (*DB) Update

func (db *DB) Update(ctx context.Context, uid types.ChatID, state types.State) error

type Memory

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

func NewMemory

func NewMemory(global map[string]string) *Memory

func (*Memory) Load

func (m *Memory) Load(_ context.Context, user types.ChatID, state types.State) error

Get user state

func (*Memory) Update

func (m *Memory) Update(_ context.Context, user types.ChatID, state types.State) error

type StateDel

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

func DelOp

func DelOp(key string) StateDel

func (StateDel) Apply

func (op StateDel) Apply(state types.State, _ ...func(string) string)

type StateSet

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

func SetOp

func SetOp(key, val string) StateSet

func (StateSet) Apply

func (op StateSet) Apply(state types.State, modifiers ...func(string) string)

type UserState

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

func NewUserState

func NewUserState() *UserState

func (*UserState) Changes added in v1.2.0

func (s *UserState) Changes() (out types.StateChanges)

func (*UserState) Close added in v1.1.0

func (s *UserState) Close()

func (*UserState) Delete

func (s *UserState) Delete(key string)

func (*UserState) Fill

func (s *UserState) Fill(data map[string]string)

func (*UserState) Get

func (s *UserState) Get(key string) (string, bool)

func (*UserState) Map

func (s *UserState) Map() (out map[string]string)

func (*UserState) Set

func (s *UserState) Set(key, value string)

Jump to

Keyboard shortcuts

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