Documentation ¶
Index ¶
- Variables
- type Account
- type AccountState
- type FirebaseStates
- type FormField
- type States
- type UserState
- func (s *UserState) AddValueToStringSlice(key FormField, value string)
- func (s *UserState) ClearForm()
- func (s *UserState) GetIntFormField(key FormField) int
- func (s *UserState) GetStringFormField(key FormField) string
- func (s *UserState) GetStringMap(key FormField) map[string]string
- func (s *UserState) GetStringSlice(key FormField) []string
- func (s *UserState) PutValueToMap(key FormField, valueKey string, value string)
- func (s *UserState) RemoveValueFromStringSlice(key FormField, value string)
- func (s *UserState) SetFormField(key FormField, value any)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Errors = errorx.NewNamespace("States") ErrRateLimited = Errors.NewType("RateLimited") )
Functions ¶
This section is empty.
Types ¶
type Account ¶ added in v0.18.0
type Account struct { Login string `firestore:"login"` Password string `firestore:"password"` Token string `firestore:"token"` RateLimitedUntil time.Time `firestore:"rateLimitedUntil"` RateLimitNextDayTime time.Time `firestore:"rateLimitNextDayTime"` State AccountState `firestore:"state"` }
func (*Account) GetStateName ¶ added in v1.4.0
type AccountState ¶ added in v0.18.0
type AccountState string
const ( AccountStateEnabled AccountState = "enabled" AccountStateDisabled AccountState = "disabled" )
type FirebaseStates ¶ added in v0.3.0
type FirebaseStates struct {
// contains filtered or unexported fields
}
func NewFirebaseState ¶ added in v0.20.0
func NewFirebaseState(logger *zap.Logger, storage *firestore.Client) *FirebaseStates
func (*FirebaseStates) GetAllStates ¶ added in v1.8.0
func (f *FirebaseStates) GetAllStates() ([]*UserState, error)
func (*FirebaseStates) GetState ¶ added in v0.3.0
func (f *FirebaseStates) GetState(userId int64) (*UserState, error)
func (*FirebaseStates) SetState ¶ added in v0.3.0
func (f *FirebaseStates) SetState(state *UserState) error
type States ¶
type States interface { // GetState Reads a user from the storage GetState(userId int64) (*UserState, error) // SetState Puts a new user into the storage. If the user already exists in the context, it's kept, SetState(state *UserState) error // GetAllStates Reads all users from the storage GetAllStates() ([]*UserState, error) }
type UserState ¶
type UserState struct { UserId int64 `firestore:"userId"` FullName string `firestore:"fullName"` Accounts []Account `firestore:"accounts"` MessageHandlerName string `firestore:"messageHandlerName"` SentMessagesCount int `firestore:"sentMessagesCount"` LastAccessAt time.Time `firestore:"lastAccessAt"` Form map[string]any `firestore:"form"` Categories string `firestore:"categories"` // contains filtered or unexported fields }
func (*UserState) AddValueToStringSlice ¶ added in v0.18.0
func (*UserState) GetIntFormField ¶ added in v0.18.0
func (*UserState) GetStringFormField ¶ added in v0.18.0
func (*UserState) GetStringMap ¶ added in v1.5.0
func (*UserState) GetStringSlice ¶ added in v0.18.0
func (*UserState) PutValueToMap ¶ added in v1.5.0
func (*UserState) RemoveValueFromStringSlice ¶ added in v1.5.0
func (*UserState) SetFormField ¶ added in v0.18.0
Click to show internal directories.
Click to hide internal directories.