shell

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 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
}

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.

Jump to

Keyboard shortcuts

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