couchdb

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client CouchDB HTTP 客户端

func NewClient

func NewClient(config *Config) *Client

NewClient 创建 CouchDB 客户端

func (*Client) CreateDatabase

func (c *Client) CreateDatabase(name string) error

CreateDatabase 创建数据库

func (*Client) CreateUser

func (c *Client) CreateUser(email, password string) error

CreateUser 创建 CouchDB 用户

func (*Client) DeleteDatabase

func (c *Client) DeleteDatabase(name string) error

DeleteDatabase 删除数据库 (可选)

func (*Client) GetDiskUsage

func (c *Client) GetDiskUsage(dbName string) (int64, error)

GetDiskUsage 获取数据库磁盘使用量(返回字节数)

func (*Client) Ping

func (c *Client) Ping() error

Ping 检查 CouchDB 连接

func (*Client) SetDatabasePermission

func (c *Client) SetDatabasePermission(dbName, email string) error

SetDatabasePermission 设置数据库权限

type Config

type Config struct {
	URL       string `json:"url"`        // CouchDB 服务器地址 (如 http://localhost:5984)
	AdminUser string `json:"admin_user"` // 管理员用户名
	AdminPass string `json:"admin_pass"` // 管理员密码
	DBPrefix  string `json:"db_prefix"`  // 用户数据库前缀 (如 userdb-)
}

type DatabaseInfo

type DatabaseInfo struct {
	DBName       string `json:"db_name"`
	DocCount     int64  `json:"doc_count"`
	DocDelCount  int64  `json:"doc_del_count"`
	DiskSize     int64  `json:"sizes_file"`     // 文件大小(字节)
	ExternalSize int64  `json:"sizes_external"` // 外部大小(字节)
	ActiveSize   int64  `json:"sizes_active"`   // 活跃大小(字节)
}

DatabaseInfo CouchDB 数据库信息

Jump to

Keyboard shortcuts

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