client

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Clients = make(map[string]Client)

Functions

func CloseClient

func CloseClient(dsn string) error

Types

type Client

type Client interface {
	TestConnection(ctx context.Context) error
	Close() error
	Tables(ctx context.Context) ([]TableSQL, error)
	Columns(ctx context.Context, schema string, name string) ([]ColumnSQL, error)
	GetDB() (*bun.DB, error)
}

func NewClient

func NewClient(dsn string) (c Client, err error)

type ClientPostgres added in v1.1.0

type ClientPostgres struct {
	*ClientSQL
}

func NewCLientPostgres added in v1.1.0

func NewCLientPostgres(dsn string) (*ClientPostgres, error)

func (*ClientPostgres) Columns added in v1.1.0

func (c *ClientPostgres) Columns(ctx context.Context, s string, n string) ([]ColumnSQL, error)

func (*ClientPostgres) Tables added in v1.1.0

func (c *ClientPostgres) Tables(ctx context.Context) ([]TableSQL, error)

type ClientRedis

type ClientRedis struct {
	Client *redis.Client
}

func NewClientRedis

func NewClientRedis(dsn string) (*ClientRedis, error)

func (*ClientRedis) Close

func (c *ClientRedis) Close() error

func (*ClientRedis) Columns added in v1.1.0

func (c *ClientRedis) Columns(ctx context.Context, s string, n string) ([]ColumnSQL, error)

func (*ClientRedis) Get

func (c *ClientRedis) Get(ctx context.Context, key string) (any, error)

func (*ClientRedis) GetDB added in v1.1.0

func (c *ClientRedis) GetDB() (*bun.DB, error)

func (*ClientRedis) GetWithExpiration

func (c *ClientRedis) GetWithExpiration(ctx context.Context, key string) (any, *int64, error)

func (*ClientRedis) Keys

func (c *ClientRedis) Keys(ctx context.Context, input string) ([]string, error)

func (*ClientRedis) Set

func (c *ClientRedis) Set(ctx context.Context, t string, k string, v any) error

func (*ClientRedis) SetWithExpiration

func (c *ClientRedis) SetWithExpiration(ctx context.Context, t string, k string, v any, e *int64) error

func (*ClientRedis) Tables added in v1.1.0

func (c *ClientRedis) Tables(ctx context.Context) ([]TableSQL, error)

func (*ClientRedis) TestConnection

func (c *ClientRedis) TestConnection(ctx context.Context) error

type ClientSQL added in v1.1.0

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

func (*ClientSQL) Close added in v1.1.0

func (c *ClientSQL) Close() error

func (*ClientSQL) Debug added in v1.1.0

func (c *ClientSQL) Debug()

func (*ClientSQL) GetDB added in v1.1.0

func (c *ClientSQL) GetDB() (*bun.DB, error)

func (*ClientSQL) TestConnection added in v1.1.0

func (c *ClientSQL) TestConnection(ctx context.Context) error

type ColumnPostgres added in v1.1.0

type ColumnPostgres struct {
	Name     string `json:"column_name"`
	DataType string `json:"data_type"`
}

type ColumnSQL added in v1.1.0

type ColumnSQL struct {
	Name     string `json:"name"`
	DataType string `json:"dataType"`
}

type TablePostgres added in v1.1.0

type TablePostgres struct {
	Name   string `json:"tablename"`
	Schema string `json:"schemaname"`
}

type TableSQL added in v1.1.0

type TableSQL struct {
	Name    string           `json:"name"`
	Schema  string           `json:"schema"`
	Columns []ColumnSQL      `json:"columns"`
	Records []map[string]any `json:"records"`
}

Jump to

Keyboard shortcuts

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