state

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 10 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 StateAdd added in v1.10.0

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

func AddOp added in v1.10.0

func AddOp(key, val string) StateAdd

func (StateAdd) Apply added in v1.10.0

func (op StateAdd) Apply(state types.State, modifiers ...func(string) string) 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) error

type StateDiv added in v1.10.0

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

func DivOp added in v1.10.0

func DivOp(key, val string) StateDiv

func (StateDiv) Apply added in v1.10.0

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

type StateMul added in v1.10.0

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

func MulOp added in v1.10.0

func MulOp(key, val string) StateMul

func (StateMul) Apply added in v1.10.0

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

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) error

type StateSub added in v1.10.0

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

func SubOp added in v1.10.0

func SubOp(key, val string) StateSub

func (StateSub) Apply added in v1.10.0

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

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