client

package
v0.0.0-...-37f8b3f Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithHTTPClient

func WithHTTPClient(cl *http.Client) func(c *Client) error

WithHTTPClient 返回一个配置自定义 HTTP 客户端的选项函数

func WithHost

func WithHost(host string) func(c *Client) error

WithHost 返回一个配置客户端主机地址的选项函数 支持普通 HTTP 地址和 Unix 套接字地址(unix://)

func WithTimeout

func WithTimeout(d time.Duration) func(c *Client) error

WithTimeout 返回一个配置客户端超时时间的选项函数

Types

type Client

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

Client 结构体表示 API 客户端

func NewClient

func NewClient(o ...Option) *Client

NewClient 创建一个新的 API 客户端实例 接受可变数量的选项函数来配置客户端

func (*Client) Blockchain

func (c *Client) Blockchain() (data blockchain.Block, err error)

Blockchain 获取区块链数据

func (*Client) Delete

func (c *Client) Delete(b, k string) (err error)

Delete 删除指定存储桶中的指定键 b: 存储桶名称 k: 键名

func (*Client) DeleteBucket

func (c *Client) DeleteBucket(b string) (err error)

DeleteBucket 删除整个存储桶 b: 存储桶名称

func (*Client) Files

func (c *Client) Files() (data []types.File, err error)

Files 获取所有文件列表

func (*Client) GetBucket

func (c *Client) GetBucket(b string) (resp map[string]blockchain.Data, err error)

GetBucket 获取指定存储桶的所有数据 b: 存储桶名称

func (*Client) GetBucketKey

func (c *Client) GetBucketKey(b, k string) (resp blockchain.Data, err error)

GetBucketKey 获取指定存储桶中指定键的值 b: 存储桶名称 k: 键名

func (*Client) GetBucketKeys

func (c *Client) GetBucketKeys(b string) (resp []string, err error)

GetBucketKeys 获取指定存储桶中的所有键 b: 存储桶名称

func (*Client) GetBuckets

func (c *Client) GetBuckets() (resp []string, err error)

GetBuckets 获取所有存储桶名称列表

func (*Client) Ledger

func (c *Client) Ledger() (data map[string]map[string]blockchain.Data, err error)

Ledger 获取完整账本数据

func (*Client) Machines

func (c *Client) Machines() (resp []types.Machine, err error)

Machines 获取所有机器列表

func (*Client) Put

func (c *Client) Put(b, k string, v interface{}) (err error)

Put 向指定存储桶的指定键写入数据 b: 存储桶名称 k: 键名 v: 要写入的值(任意类型)

func (*Client) Services

func (c *Client) Services() (resp []types.Service, err error)

Services 获取所有服务列表

func (*Client) Summary

func (c *Client) Summary() (data types.Summary, err error)

Summary 获取系统摘要信息

func (*Client) Users

func (c *Client) Users() (data []types.User, err error)

Users 获取所有用户列表

type Option

type Option func(c *Client) error

Option 定义客户端选项函数类型

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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