shell

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeResponse

func DecodeResponse(res string) (any, error)

DecodeResponse decodes a shell response string to a JSON response.

func ResponseToJSONString

func ResponseToJSONString(res string) string

ResponseToJSONString converts a shell response string to a JSON string.

func UnmarshalResponse

func UnmarshalResponse(res string, to any) (any, error)

UnmarshalResponse unmarshals a shell response string to a JSON response.

Types

type Client

type Client struct {
	*Config
}

func NewClient

func NewClient() *Client

NewClient returns a shell client instance.

func (*Client) Close

func (client *Client) Close() error

Close closes the database.

func (*Client) Open

func (client *Client) Open() error

Open opens a database specified by the internal configuration.

func (*Client) Query

func (client *Client) Query(query string) (any, error)

Query executes a query and returns a result.

type Config

type Config struct {
	Host                  string
	Port                  int
	TLSEnabled            bool
	TLSCertificateKeyFile string
	TLSCAFile             string
}

Config stores server configuration parammeters.

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a default configuration instance.

func (*Config) SetHost

func (config *Config) SetHost(host string)

SetHost sets a host address.

func (*Config) SetPort

func (config *Config) SetPort(port int)

SetPort sets a listen port.

func (*Config) SetTLSCAFile added in v1.1.2

func (config *Config) SetTLSCAFile(file string)

SetTLSCAFile sets a TLS CA file.

func (*Config) SetTLSCertificateKeyFile added in v1.1.2

func (config *Config) SetTLSCertificateKeyFile(file string)

SetTLSCertificateKeyFile sets a TLS certificate key file.

func (*Config) SetTLSEnabled added in v1.1.2

func (config *Config) SetTLSEnabled(enabled bool)

SetTLSEnabled sets a TLS enabled flag.

Jump to

Keyboard shortcuts

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