Documentation
¶
Index ¶
- func MySQLResetRootPassword(password string) error
- type ClickHouse
- func (r *ClickHouse) Close()
- func (r *ClickHouse) DatabaseCreate(name string) error
- func (r *ClickHouse) DatabaseDrop(name string) error
- func (r *ClickHouse) DatabaseExists(name string) (bool, error)
- func (r *ClickHouse) DatabaseSize(name string) (int64, error)
- func (r *ClickHouse) Databases() ([]Database, error)
- func (r *ClickHouse) Exec(query string, args ...any) (sql.Result, error)
- func (r *ClickHouse) Ping() error
- func (r *ClickHouse) Prepare(query string) (*sql.Stmt, error)
- func (r *ClickHouse) PrivilegesGrant(user, database string, host ...string) error
- func (r *ClickHouse) PrivilegesRevoke(user, database string, host ...string) error
- func (r *ClickHouse) Query(query string, args ...any) (*sql.Rows, error)
- func (r *ClickHouse) QueryRow(query string, args ...any) *sql.Row
- func (r *ClickHouse) UserCreate(user, password string, host ...string) error
- func (r *ClickHouse) UserDrop(user string, host ...string) error
- func (r *ClickHouse) UserPassword(user, password string, host ...string) error
- func (r *ClickHouse) UserPrivileges(user string, host ...string) ([]string, error)
- func (r *ClickHouse) Users() ([]User, error)
- type Database
- type ESDocument
- type ESIndex
- type Elasticsearch
- func (r *Elasticsearch) Close()
- func (r *Elasticsearch) DocumentCreate(index, body string) error
- func (r *Elasticsearch) DocumentDelete(index, id string) error
- func (r *Elasticsearch) DocumentGet(index, id string) (*ESDocument, error)
- func (r *Elasticsearch) DocumentUpdate(index, id, body string) error
- func (r *Elasticsearch) IndexCreate(name string) error
- func (r *Elasticsearch) IndexDelete(name string) error
- func (r *Elasticsearch) Indices() ([]ESIndex, error)
- func (r *Elasticsearch) Ping() error
- func (r *Elasticsearch) Search(index, query string, page, pageSize int) ([]ESDocument, int64, error)
- type MongoDB
- func (r *MongoDB) Close()
- func (r *MongoDB) DatabaseCreate(name string) error
- func (r *MongoDB) DatabaseDrop(name string) error
- func (r *MongoDB) Databases() ([]MongoDatabase, error)
- func (r *MongoDB) Ping() error
- func (r *MongoDB) UserCreate(user, password, database string) error
- func (r *MongoDB) UserDrop(user, database string) error
- func (r *MongoDB) UserPassword(user, password string) error
- func (r *MongoDB) Users() ([]MongoUser, error)
- type MongoDatabase
- type MongoUser
- type MySQL
- func (r *MySQL) Close()
- func (r *MySQL) DatabaseCreate(name string) error
- func (r *MySQL) DatabaseDrop(name string) error
- func (r *MySQL) DatabaseExists(name string) (bool, error)
- func (r *MySQL) DatabaseSize(name string) (int64, error)
- func (r *MySQL) Databases() ([]Database, error)
- func (r *MySQL) Exec(query string, args ...any) (sql.Result, error)
- func (r *MySQL) Ping() error
- func (r *MySQL) Prepare(query string) (*sql.Stmt, error)
- func (r *MySQL) PrivilegesGrant(user, database string, host ...string) error
- func (r *MySQL) PrivilegesRevoke(user, database string, host ...string) error
- func (r *MySQL) Query(query string, args ...any) (*sql.Rows, error)
- func (r *MySQL) QueryRow(query string, args ...any) *sql.Row
- func (r *MySQL) UserCreate(user, password string, host ...string) error
- func (r *MySQL) UserDrop(user string, host ...string) error
- func (r *MySQL) UserPassword(user, password string, host ...string) error
- func (r *MySQL) UserPrivileges(user string, host ...string) ([]string, error)
- func (r *MySQL) Users() ([]User, error)
- type Operator
- type Postgres
- func (r *Postgres) Close()
- func (r *Postgres) DatabaseComment(name, comment string) error
- func (r *Postgres) DatabaseCreate(name string) error
- func (r *Postgres) DatabaseDrop(name string) error
- func (r *Postgres) DatabaseExists(name string) (bool, error)
- func (r *Postgres) DatabaseSize(name string) (int64, error)
- func (r *Postgres) Databases() ([]Database, error)
- func (r *Postgres) Exec(query string, args ...any) (sql.Result, error)
- func (r *Postgres) Ping() error
- func (r *Postgres) Prepare(query string) (*sql.Stmt, error)
- func (r *Postgres) PrivilegesGrant(user, database string, host ...string) error
- func (r *Postgres) PrivilegesRevoke(user, database string, host ...string) error
- func (r *Postgres) Query(query string, args ...any) (*sql.Rows, error)
- func (r *Postgres) QueryRow(query string, args ...any) *sql.Row
- func (r *Postgres) UserCreate(user, password string, host ...string) error
- func (r *Postgres) UserDrop(user string, host ...string) error
- func (r *Postgres) UserPassword(user, password string, host ...string) error
- func (r *Postgres) UserPrivileges(user string, host ...string) ([]string, error)
- func (r *Postgres) Users() ([]User, error)
- type Redis
- func (r *Redis) Clear() error
- func (r *Redis) Close()
- func (r *Redis) Data(page, pageSize int) ([]RedisKV, int, error)
- func (r *Redis) Database() (int, error)
- func (r *Redis) Del(keys ...string) error
- func (r *Redis) Exec(command string, args ...any) (any, error)
- func (r *Redis) Expire(key string, ttl int64) error
- func (r *Redis) Get(key string) (*RedisKV, error)
- func (r *Redis) Rename(oldKey, newKey string) error
- func (r *Redis) Search(pattern string, page, pageSize int) ([]RedisKV, int, error)
- func (r *Redis) Select(db int) error
- func (r *Redis) SetKey(key, value, keyType string, ttl int64) error
- func (r *Redis) Size() (int, error)
- type RedisKV
- type SQLite
- type SQLiteColumn
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MySQLResetRootPassword ¶
MySQLResetRootPassword 重置 MySQL root密码
Types ¶
type ClickHouse ¶ added in v3.2.0
type ClickHouse struct {
// contains filtered or unexported fields
}
ClickHouse 通过 HTTP API 操作 ClickHouse
func NewClickHouse ¶ added in v3.2.0
func NewClickHouse(username, password, address string) (*ClickHouse, error)
NewClickHouse 创建 ClickHouse 连接(HTTP API)
func (*ClickHouse) Close ¶ added in v3.2.0
func (r *ClickHouse) Close()
func (*ClickHouse) DatabaseCreate ¶ added in v3.2.0
func (r *ClickHouse) DatabaseCreate(name string) error
func (*ClickHouse) DatabaseDrop ¶ added in v3.2.0
func (r *ClickHouse) DatabaseDrop(name string) error
func (*ClickHouse) DatabaseExists ¶ added in v3.2.0
func (r *ClickHouse) DatabaseExists(name string) (bool, error)
func (*ClickHouse) DatabaseSize ¶ added in v3.2.0
func (r *ClickHouse) DatabaseSize(name string) (int64, error)
func (*ClickHouse) Databases ¶ added in v3.2.0
func (r *ClickHouse) Databases() ([]Database, error)
func (*ClickHouse) Ping ¶ added in v3.2.0
func (r *ClickHouse) Ping() error
func (*ClickHouse) Prepare ¶ added in v3.2.0
func (r *ClickHouse) Prepare(query string) (*sql.Stmt, error)
func (*ClickHouse) PrivilegesGrant ¶ added in v3.2.0
func (r *ClickHouse) PrivilegesGrant(user, database string, host ...string) error
func (*ClickHouse) PrivilegesRevoke ¶ added in v3.2.0
func (r *ClickHouse) PrivilegesRevoke(user, database string, host ...string) error
func (*ClickHouse) QueryRow ¶ added in v3.2.0
func (r *ClickHouse) QueryRow(query string, args ...any) *sql.Row
func (*ClickHouse) UserCreate ¶ added in v3.2.0
func (r *ClickHouse) UserCreate(user, password string, host ...string) error
func (*ClickHouse) UserDrop ¶ added in v3.2.0
func (r *ClickHouse) UserDrop(user string, host ...string) error
func (*ClickHouse) UserPassword ¶ added in v3.2.0
func (r *ClickHouse) UserPassword(user, password string, host ...string) error
func (*ClickHouse) UserPrivileges ¶ added in v3.2.0
func (r *ClickHouse) UserPrivileges(user string, host ...string) ([]string, error)
func (*ClickHouse) Users ¶ added in v3.2.0
func (r *ClickHouse) Users() ([]User, error)
type ESDocument ¶ added in v3.2.0
type ESDocument struct {
ID string `json:"id"`
Index string `json:"index"`
Source string `json:"source"`
}
ESDocument 文档信息
type ESIndex ¶ added in v3.2.0
type ESIndex struct {
Name string `json:"name"`
Health string `json:"health"`
Status string `json:"status"`
DocsCount string `json:"docs_count"`
StoreSize string `json:"store_size"`
}
ESIndex 索引信息
type Elasticsearch ¶ added in v3.2.0
type Elasticsearch struct {
// contains filtered or unexported fields
}
Elasticsearch 通过 REST API 操作 Elasticsearch/OpenSearch
func NewElasticsearch ¶ added in v3.2.0
func NewElasticsearch(address, username, password string) (*Elasticsearch, error)
NewElasticsearch 创建 Elasticsearch 连接
func (*Elasticsearch) Close ¶ added in v3.2.0
func (r *Elasticsearch) Close()
func (*Elasticsearch) DocumentCreate ¶ added in v3.2.0
func (r *Elasticsearch) DocumentCreate(index, body string) error
DocumentCreate 创建文档(自动生成 ID)
func (*Elasticsearch) DocumentDelete ¶ added in v3.2.0
func (r *Elasticsearch) DocumentDelete(index, id string) error
DocumentDelete 删除文档
func (*Elasticsearch) DocumentGet ¶ added in v3.2.0
func (r *Elasticsearch) DocumentGet(index, id string) (*ESDocument, error)
DocumentGet 获取文档
func (*Elasticsearch) DocumentUpdate ¶ added in v3.2.0
func (r *Elasticsearch) DocumentUpdate(index, id, body string) error
DocumentUpdate 更新文档
func (*Elasticsearch) IndexCreate ¶ added in v3.2.0
func (r *Elasticsearch) IndexCreate(name string) error
IndexCreate 创建索引
func (*Elasticsearch) IndexDelete ¶ added in v3.2.0
func (r *Elasticsearch) IndexDelete(name string) error
IndexDelete 删除索引
func (*Elasticsearch) Indices ¶ added in v3.2.0
func (r *Elasticsearch) Indices() ([]ESIndex, error)
Indices 获取所有索引
func (*Elasticsearch) Ping ¶ added in v3.2.0
func (r *Elasticsearch) Ping() error
func (*Elasticsearch) Search ¶ added in v3.2.0
func (r *Elasticsearch) Search(index, query string, page, pageSize int) ([]ESDocument, int64, error)
Search 搜索文档
type MongoDB ¶ added in v3.2.0
type MongoDB struct {
// contains filtered or unexported fields
}
MongoDB 通过 mongosh CLI 操作 MongoDB
func NewMongoDB ¶ added in v3.2.0
NewMongoDB 创建 MongoDB 连接
func (*MongoDB) DatabaseCreate ¶ added in v3.2.0
DatabaseCreate 创建数据库(MongoDB 通过创建集合来显式创建数据库)
func (*MongoDB) DatabaseDrop ¶ added in v3.2.0
DatabaseDrop 删除数据库
func (*MongoDB) Databases ¶ added in v3.2.0
func (r *MongoDB) Databases() ([]MongoDatabase, error)
Databases 获取数据库列表
func (*MongoDB) UserCreate ¶ added in v3.2.0
UserCreate 创建用户
func (*MongoDB) UserPassword ¶ added in v3.2.0
UserPassword 修改用户密码
type MongoDatabase ¶ added in v3.2.0
MongoDatabase MongoDB 数据库信息
type MongoUser ¶ added in v3.2.0
type MongoUser struct {
User string `json:"user"`
DB string `json:"db"`
Roles []string `json:"roles"`
}
MongoUser MongoDB 用户信息
type MySQL ¶
type MySQL struct {
// contains filtered or unexported fields
}
func (*MySQL) DatabaseCreate ¶
func (*MySQL) DatabaseDrop ¶
func (*MySQL) PrivilegesGrant ¶
func (*MySQL) PrivilegesRevoke ¶
func (*MySQL) UserPassword ¶
func (*MySQL) UserPrivileges ¶
type Operator ¶
type Operator interface {
Close()
Ping() error
Query(query string, args ...any) (*sql.Rows, error)
QueryRow(query string, args ...any) *sql.Row
Exec(query string, args ...any) (sql.Result, error)
Prepare(query string) (*sql.Stmt, error)
DatabaseCreate(name string) error
DatabaseDrop(name string) error
DatabaseExists(name string) (bool, error)
DatabaseSize(name string) (int64, error)
UserCreate(user, password string, host ...string) error
UserDrop(user string, host ...string) error
UserPassword(user, password string, host ...string) error
UserPrivileges(user string, host ...string) ([]string, error)
PrivilegesGrant(user, database string, host ...string) error
PrivilegesRevoke(user, database string, host ...string) error
Users() ([]User, error)
Databases() ([]Database, error)
}
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
func (*Postgres) DatabaseComment ¶
func (*Postgres) DatabaseCreate ¶
func (*Postgres) DatabaseDrop ¶
func (*Postgres) PrivilegesGrant ¶
func (*Postgres) PrivilegesRevoke ¶
func (*Postgres) UserCreate ¶
func (*Postgres) UserPassword ¶
func (*Postgres) UserPrivileges ¶
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
type SQLite ¶ added in v3.2.0
type SQLite struct {
// contains filtered or unexported fields
}
SQLite 通过 database/sql 操作 SQLite 文件
Click to show internal directories.
Click to hide internal directories.