system

package
v0.0.0-...-e61ee7f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() error

Init initialize AppState interface

Types

type DBStore

type DBStore struct{}

DBStore can be used to store app state items in local filesystem

func (*DBStore) Get

func (f *DBStore) Get(ctx context.Context, item StateItem) error

Get reads the state item

func (*DBStore) Set

func (f *DBStore) Set(ctx context.Context, item StateItem) error

Set saves the state item

type RuntimeState

type RuntimeState struct {
	LastAppPath    string `json:"last_app_path"`
	LastCustomConf string `json:"last_custom_conf"`
}

RuntimeState contains app state for runtime, and we can save remote version for update checker here in future

func (RuntimeState) Name

func (a RuntimeState) Name() string

Name returns the item name

type StateItem

type StateItem interface {
	Name() string
}

StateItem provides the name for a state item. the name will be used to generate filenames, etc

type StateStore

type StateStore interface {
	Get(ctx context.Context, item StateItem) error
	Set(ctx context.Context, item StateItem) error
}

StateStore is the interface to get/set app state items

var AppState StateStore

AppState contains the state items for the app

Jump to

Keyboard shortcuts

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