kylin

package
v1.7.17 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTrace

func SetTrace(t bool)

Types

type Client

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

Client 客户端

func New

func New(config *Config) *Client

New 新连接

func (*Client) CreateCube

func (client *Client) CreateCube(cubeName string) (code int, body []byte, err error)

CreateCube 创建cube

func (*Client) GetCube

func (client *Client) GetCube(cubeName string) (code int, body []byte, err error)

GetCube 获取cube //cubeName 必须参数

func (*Client) GetCubeDesc

func (client *Client) GetCubeDesc(cubeName string) (code int, body []byte, err error)

GetCubeDesc 获取cube描述 //cubeName 必须参数

func (*Client) GetModel

func (client *Client) GetModel(modelName string) (code int, body []byte, err error)

GetModel 获取model modelName 必须参数

func (*Client) ListCubes

func (client *Client) ListCubes(offset, limit int, cubeName, projectName string) (code int, body []byte, err error)

ListCubes 列出cubes offset limit 必须参数 cubeName, projectName 可选参数

func (*Client) ListTables

func (client *Client) ListTables(project string) (code int, body []byte, err error)

ListTables 列出tables project 必须参数

func (*Client) Login

func (client *Client) Login() (code int, body []byte, err error)

Login 登陆

func (*Client) Query

func (client *Client) Query(sql, project string, offset, limit int) (*QueryResult, error)

Query 执行语句

func (*Client) QueryKylin

func (client *Client) QueryKylin(query *Query) (code int, body []byte, err error)

QueryKylin 查询

type Column

type Column struct {
	IsNullable         int    `json:"isNullable"`
	DisplaySize        int    `json:"displaySize"`
	Label              string `json:"label"`
	Name               string `json:"name"`
	SchemaName         string `json:"schemaName"`
	CatelogName        string `json:"catelogName"`
	TableName          string `json:"tableName"`
	Precision          int    `json:"precision"`
	Scale              int    `json:"scale"`
	ColumnType         int    `json:"columnType"`
	ColumnTypeName     string `json:"columnTypeName"`
	ReadOnly           bool   `json:"readOnly"`
	AutoIncrement      bool   `json:"autoIncrement"`
	CaseSensitive      bool   `json:"caseSensitive"`
	Searchable         bool   `json:"searchable"`
	Currency           bool   `json:"currency"`
	Signed             bool   `json:"signed"`
	DefinitelyWritable bool   `json:"definitelyWritable"`
	Writable           bool   `json:"writable"`
}

Column 字段

type Config

type Config struct {
	Username string //账号 root
	Password string //密码
	Host     string //地址
}

Config 数据库配置

type H

type H map[string]interface{}

H 是map[string]interface{} 简写

type Proxy

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

Proxy 代理

func NewProxy

func NewProxy() *Proxy

NewProxy 代理池

func (*Proxy) NameSpace

func (proxy *Proxy) NameSpace(group string) *Client

NameSpace 获取分组

func (*Proxy) SetNameSpace

func (proxy *Proxy) SetNameSpace(group string, client *Client)

SetNameSpace 设置组

type Query

type Query struct {
	SQL           string `json:"sql"`
	Offset        int    `json:"offset"`
	Limit         int    `json:"limit"`
	AcceptPartial bool   `json:"acceptPartial"`
	Project       string `json:"project"`
}

Query 查询条件封装

func (*Query) GetBytes

func (query *Query) GetBytes() (body []byte)

GetBytes 对象转json

type QueryOut

type QueryOut struct {
	ColumnMetas []string      `json:"columnMetas"`
	Result      []interface{} `json:"results"`
}

QueryOut 返回上层数据

type QueryResult

type QueryResult struct {
	ColumnMetas       []*Column     `json:"columnMetas"`
	Result            []interface{} `json:"results"`
	Cube              string        `json:"cube"`
	AffectedRowCount  int           `json:"affectedRowCount"`
	IsException       bool          `json:"isException"`
	ExceptionMessage  string        `json:"exceptionMessage"`
	Duration          int           `json:"duration"`
	TotalScanCount    int           `json:"totalScanCount"`
	HitExceptionCache bool          `json:"hitExceptionCache"`
	StorageCacheUsed  bool          `json:"storageCacheUsed"`
	Partial           bool          `json:"partial"`
}

QueryResult 查询后正常的返回结果

Jump to

Keyboard shortcuts

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