api

package module
v0.0.0-...-0c27b81 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppRoot string
View Source
var Connections = make([]*Connection, 0)
View Source
var DefaultConfig = &Config{}
View Source
var GlobalStorage = &Storage{}

Functions

func AppDataPath

func AppDataPath() string

func LoadConnections

func LoadConnections() error

func LoadLuas

func LoadLuas(luas *[]Lua) error

LoadLuas load all lua scripts

func RecordsToStruct

func RecordsToStruct[T any](records [][]byte, vs *[]T) error

RecordsToStruct is convert records to []T

Types

type Command

type Command struct {
	ID       string          `json:"id"`
	Commands [][]interface{} `json:"commands"`
}

Command .

type Config

type Config struct {
	Theme    string `json:"theme"`
	Language string `json:"language"`
}

func (*Config) Get

func (c *Config) Get() error

func (*Config) Set

func (c *Config) Set() error

type Connection

type Connection struct {
	ID                 string     `json:"id"`
	Name               string     `json:"name"`
	Host               string     `json:"host"`
	Port               int        `json:"port"`
	Addrs              []string   `json:"addrs"`
	Username           string     `json:"username"`
	Auth               string     `json:"auth"`
	KeysPattern        string     `json:"keysPattern"`
	NamespaceSeparator string     `json:"namespaceSeparator"`
	TimeoutConnect     int64      `json:"timeoutConnect"`
	TimeoutExecute     int64      `json:"timeoutExecute"`
	DbScanLimit        int32      `json:"dbScanLimit"`
	DataScanLimit      int32      `json:"dataScanLimit"`
	Tls                Tls        `json:"tls"`
	SSHOptions         SSHOptions `json:"ssh"`
	IsCluster          bool       `json:"isCluster"`
	IsSentinel         bool       `json:"isSentinel"`
	SentinelPassword   string     `json:"sentinelPassword"`
	MasterName         string     `json:"masterName"`
	RouteByLatency     bool       `json:"routeByLatency"`
	RouteRandomly      bool       `json:"routeRandomly"`
	// contains filtered or unexported fields
}

Connection .

func GetConnection

func GetConnection(id string) (*Connection, error)

func (*Connection) Command

func (c *Connection) Command(commands [][]interface{}) ([]interface{}, error)

Command .

func (*Connection) Delete

func (c *Connection) Delete() error

Delete .

func (*Connection) Disconnection

func (c *Connection) Disconnection() error

Disconnection .

func (*Connection) Edit

func (c *Connection) Edit() error

Edit .

func (*Connection) New

func (c *Connection) New() error

New .

func (*Connection) Open

func (c *Connection) Open() error

Open .

func (*Connection) Scripting

func (c *Connection) Scripting(lua *Lua) error

Scripting lua script

func (*Connection) Suggestions

func (c *Connection) Suggestions(command string) []string

func (*Connection) Test

func (c *Connection) Test() error

Test .

type ConnectionEntry

type ConnectionEntry struct {
	ID         string
	Connection string
}

ConnectionEntry .

type Lua

type Lua struct {
	ConnectionID    string        `json:"connectionID"`
	ID              string        `json:"id"`
	Name            string        `json:"name"`
	Keys            []string      `json:"keys"`
	Args            []interface{} `json:"args"`
	Script          string        `json:"script"`
	LastExecutionAt int64         `json:"lastExecutionAt"`
	Elapsed         string        `json:"elapsed"`
	Result          interface{}   `json:"result"`
}

func (*Lua) Delete

func (l *Lua) Delete() error

Delete .

func (*Lua) Edit

func (l *Lua) Edit() error

Edit .

func (*Lua) New

func (l *Lua) New() error

New add lua script

type SSHOptions

type SSHOptions struct {
	Enable     bool   `json:"enable"`
	User       string `json:"user"`
	Password   string `json:"password"`
	Host       string `json:"host"`
	Port       int    `json:"port"`
	Privatekey string `json:"privatekey"`
}

type Storage

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

func (*Storage) Delete

func (o *Storage) Delete(collection string, key string) error

Delete key from collection

func (*Storage) Initialize

func (o *Storage) Initialize(dir string) error

Initialize .

func (*Storage) Read

func (o *Storage) Read(collection string, key string, value interface{}) error

Read record from collection

func (*Storage) ReadAll

func (o *Storage) ReadAll(collection string, records *[][]byte) error

ReadAll .

func (*Storage) Write

func (o *Storage) Write(collection string, key string, value interface{}) error

Write v to collection

type Tls

type Tls struct {
	Enable bool   `json:"enable"`
	Cert   string `json:"cert"`
	Key    string `json:"key"`
	Ca     string `json:"ca"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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