state

package
v0.0.0-...-822bfe8 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToJSON

func ToJSON(st *State) (postgres.Jsonb, error)

Types

type ID

type ID int
const (
	None ID = iota
)

type State

type State struct {
	State       ID // Conversation state.
	StateBefore ID // State before handling the current update.

	TelegramID   int
	Username     string
	FirstName    string
	LastName     string
	LanguageCode string

	CannotReceiveMessages bool // It's true, for example, when the user blocked the bot

	LastActionAt time.Time
}

func FromJSON

func FromJSON(j postgres.Jsonb) (*State, error)

func LoadState

func LoadState(db *gorm.DB, telegramID int) (*State, error)

func (*State) Save

func (s *State) Save(db *gorm.DB) error

type StateDB

type StateDB struct {
	gorm.Model
	TelegramID int
	State      postgres.Jsonb
}

func (StateDB) TableName

func (s StateDB) TableName() string

Jump to

Keyboard shortcuts

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