client

package
v0.0.0-...-326cea8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BinaryV1MagicNumber            = 0x0101
	BinaryV1CompressionMagicNumber = 0x0102
)
View Source
const (
	DefaultMaxIdle        = 10
	DefaultMaxIdleGlobal  = 2147483647
	DefaultMaxIdleTimeout = time.Millisecond * 2500
	DefaultRpcTimeout     = time.Millisecond * 6000
)

Variables

This section is empty.

Functions

func DecodeEx

func DecodeEx(bts []byte, useStruct bool) (ret structure.Element, err error)

func NewDebugMiddleWare

func NewDebugMiddleWare() endpoint.Middleware

Types

type AuthType

type AuthType int
const (
	AuthType_DisableAuth AuthType = iota
	AuthType_PasswordSha256
	AuthType_PasswordEncrypt
)

type Client

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

func NewClient

func NewClient(ops ...Option) (*Client, error)

Create a goroutine-safe ByteGraph client.

func (*Client) BatchSubmit

func (c *Client) BatchSubmit(ctx context.Context, query []string, table ...string) ([]structure.Element, []error)

need to check first err with ErrorCode_SYSTEM_ERROR and ErrorCode_INVALID_REQUEST

func (*Client) Submit

func (c *Client) Submit(ctx context.Context, query string, table ...string) (structure.Element, error)

table is used to specify a temporary table in replace of default table to use in the request.

type DebugKey

type DebugKey struct {
}

type Option

type Option func(*Options)

func WithAuthPort

func WithAuthPort(port int) Option

func WithDefaultTable

func WithDefaultTable(table string) Option

func WithHostPort

func WithHostPort(hosts ...string) Option

Specify hosts for the client to connect to

func WithRpcTimeout

func WithRpcTimeout(d time.Duration) Option

func WithServiceNamePort

func WithServiceNamePort(domainName string, port int) Option

func WithUserPwd

func WithUserPwd(username, password string) Option

Authentication

func WithUserPwdEncrypted

func WithUserPwdEncrypted(username, password string) Option

type Options

type Options struct {
	DefaultTable string

	HostPorts []string

	MaxIdle         int
	MaxIdleGlobal   int
	MaxIdleTimeout  time.Duration
	RpcTimeout      time.Duration
	DecodeUseStruct bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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