persistence

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SessionMarshaller

func SessionMarshaller() ([]byte, error)

SessionMarshaller implementation for YamlDB

Types

type Session

type Session struct {
	Login       string `yaml:":login"`
	Timezone    string `yaml:":timezone"`
	KeepOnline  bool   `yaml:":keeponline"`
	RawMessages bool   `yaml:":rawmessages"`
	AsciiArrows bool   `yaml:":asciiarrows"`
	OOBMode     bool   `yaml:":oobmode"`
	Carbons     bool   `yaml:":carbons"`
	HideIds     bool   `yaml:":hideids"`
}

Session is a key-values subtree

func (*Session) Get

func (s *Session) Get(key string) (string, error)

Get retrieves a session value

func (*Session) Set

func (s *Session) Set(key string, value string) (string, error)

Set sets a session value

func (*Session) TimezoneToLocation

func (s *Session) TimezoneToLocation() *time.Location

TimezoneToLocation tries to convert config timezone to location

func (*Session) ToMap

func (s *Session) ToMap() map[string]string

ToMap converts the session to a map

type SessionsMap

type SessionsMap struct {
	Sessions map[string]Session `yaml:":sessions"`
}

SessionsMap is for :sessions: subtree

type SessionsYamlDB

type SessionsYamlDB struct {
	yamldb.YamlDB
	Data *SessionsMap
}

SessionsYamlDB wraps YamlDB with Session

func LoadSessions

func LoadSessions(path string) (*SessionsYamlDB, error)

LoadSessions restores TDlib sessions from the previous run

Jump to

Keyboard shortcuts

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