open
pub fn open(endpoint string, token string, org string, bucket string) Client用途
打开。
参数
endpointstring- endpoint(string)
tokenstring- token(string)
orgstring- org(string)
bucketstring- bucket(string)
返回
Client — 该类型的值
API
#github.com/xulang-org/packages/influxdb扩展包 `influxdb #github.com/xulang-org/packages/influxdb`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
openpub fn open(endpoint string, token string, org string, bucket string) Client打开。
endpoint stringtoken stringorg stringbucket stringClient — 该类型的值
open_pool_clientpub fn open_pool_client(endpoint string, token string, org string, bucket string, max_idle int) Pool打开pool客户端。
endpoint stringtoken stringorg stringbucket stringmax_idle intPool — 该类型的值
struct Responsepub struct Response {
pub status_code int
pub body string
}公开结构体 `Response`。
status_code intbody stringstruct Clientpub struct Client {
pub host string
pub port int
pub token string
pub org string
pub bucket string
}公开结构体 `Client`。
host stringport inttoken stringorg stringbucket stringnew_clientpub fn new_client(endpoint string, token string, org string, bucket string) Client构造 client。
endpoint stringtoken stringorg stringbucket stringClient — 该类型的值
(&mut Client) requestpub fn (c &mut Client) request(method string, path string, body string, content_type string, accept string) Response`&mut Client` 上的方法:请求。失败时 throw。
c &mut Clientmethod stringpath stringbody stringcontent_type stringaccept stringResponse — 该类型的值
struct Tagpub struct Tag {
pub key string
pub val string
}公开结构体 `Tag`。
key stringval stringstruct Fieldpub struct Field {
pub key string
pub val string
}公开结构体 `Field`。
key stringval stringstruct Pointpub struct Point {
pub measurement string
pub tags []Tag
pub fields []Field
pub timestamp int
}公开结构体 `Point`。
measurement stringtags []Tagfields []Fieldtimestamp intnew_pointpub fn new_point(measurement string) Point构造 point。
measurement stringPoint — 该类型的值
(&mut Point) add_tagpub fn (p &mut Point) add_tag(key string, val string)`&mut Point` 上的方法:增加标签。
p &mut Pointkey stringval string(&mut Point) add_field_stringpub fn (p &mut Point) add_field_string(key string, val string)`&mut Point` 上的方法:增加field字符串。
p &mut Pointkey stringval string(&mut Point) add_field_intpub fn (p &mut Point) add_field_int(key string, val int)`&mut Point` 上的方法:增加fieldint。
p &mut Pointkey stringval int(&mut Point) add_field_floatpub fn (p &mut Point) add_field_float(key string, val string)`&mut Point` 上的方法:增加fieldfloat。
p &mut Pointkey stringval string(&mut Point) add_field_boolpub fn (p &mut Point) add_field_bool(key string, val bool)`&mut Point` 上的方法:增加fieldbool。
p &mut Pointkey stringval bool(&mut Point) set_timestamppub fn (p &mut Point) set_timestamp(ts int)`&mut Point` 上的方法:设置 timestamp。
p &mut Pointts int(&Point) to_linepub fn (p &Point) to_line() string`&Point` 上的方法:转换为 line。
p &Pointstring — 结果字符串
(&mut Client) write_pointpub fn (c &mut Client) write_point(point Point) bool`&mut Client` 上的方法:写入point。失败时 throw。
c &mut Clientpoint Pointbool — 是否成立
(&mut Client) write_linepub fn (c &mut Client) write_line(line string) bool`&mut Client` 上的方法:写入line。失败时 throw。
c &mut Clientline stringbool — 是否成立
(&mut Client) write_rawpub fn (c &mut Client) write_raw(lines string) bool`&mut Client` 上的方法:写入raw。失败时 throw。
c &mut Clientlines stringbool — 是否成立
struct Poolpub struct Pool {
pub host string
pub port int
pub token string
pub org string
pub bucket string
pub state chan pool.State
pub max_idle int
}公开结构体 `Pool`。
host stringport inttoken stringorg stringbucket stringstate chan pool.Statemax_idle intnew_poolpub fn new_pool(endpoint string, token string, org string, bucket string, max_idle int) Pool构造 pool。
endpoint stringtoken stringorg stringbucket stringmax_idle intPool — 该类型的值
open_poolpub fn open_pool(endpoint string, token string, org string, bucket string, max_idle int) Pool打开pool。
endpoint stringtoken stringorg stringbucket stringmax_idle intPool — 该类型的值
(&Pool) getpub fn (p &Pool) get() Client在 `&Pool` 上调用 `get`。
p &PoolClient — 该类型的值
(&Pool) duppub fn (p &Pool) dup() Pool在 `&Pool` 上调用 `dup`。
p &PoolPool — 该类型的值
(&Pool) get_connpub fn (p &Pool) get_conn() int`&Pool` 上的方法:读取 conn。
p &Poolint — 该类型的值
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)`&Pool` 上的方法:put连接。
p &Poolfd int(&Pool) discard_connpub fn (p &Pool) discard_conn(fd int)`&Pool` 上的方法:丢弃连接。
p &Poolfd int(&Pool) write_pointpub fn (p &Pool) write_point(point Point) bool`&Pool` 上的方法:写入point。失败时 throw。
p &Poolpoint Pointbool — 是否成立
(&Pool) write_linepub fn (p &Pool) write_line(line string) bool`&Pool` 上的方法:写入line。失败时 throw。
p &Poolline stringbool — 是否成立
(&Pool) write_rawpub fn (p &Pool) write_raw(lines string) bool`&Pool` 上的方法:写入raw。失败时 throw。
p &Poollines stringbool — 是否成立
(&Pool) query_fluxpub fn (p &Pool) query_flux(flux string) string`&Pool` 上的方法:查询串flux。失败时 throw。
p &Poolflux stringstring — 结果字符串
(&Pool) pingpub fn (p &Pool) ping() bool在 `&Pool` 上调用 `ping`。失败时 throw。
p &Poolbool — 是否成立
(&Pool) closepub fn (p &Pool) close()`&Pool` 上的方法:关闭资源。
p &Pool(&mut Client) healthpub fn (c &mut Client) health() bool在 `&mut Client` 上调用 `health`。失败时 throw。
c &mut Clientbool — 是否成立
(&mut Client) pingpub fn (c &mut Client) ping() bool在 `&mut Client` 上调用 `ping`。失败时 throw。
c &mut Clientbool — 是否成立
(&mut Client) query_fluxpub fn (c &mut Client) query_flux(flux string) string`&mut Client` 上的方法:查询串flux。失败时 throw。
c &mut Clientflux stringstring — 结果字符串