db

package
v0.0.0-...-b515019 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MySQLResetRootPassword

func MySQLResetRootPassword(password string) error

MySQLResetRootPassword 重置 MySQL root密码

Types

type MySQL

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

func NewMySQL

func NewMySQL(username, password, address string, typ ...string) (*MySQL, error)

func (*MySQL) Close

func (r *MySQL) Close() error

func (*MySQL) DatabaseCreate

func (r *MySQL) DatabaseCreate(name string) error

func (*MySQL) DatabaseDrop

func (r *MySQL) DatabaseDrop(name string) error

func (*MySQL) DatabaseExists

func (r *MySQL) DatabaseExists(name string) (bool, error)

func (*MySQL) DatabaseSize

func (r *MySQL) DatabaseSize(name string) (int64, error)

func (*MySQL) Databases

func (r *MySQL) Databases() ([]types.MySQLDatabase, error)

func (*MySQL) Exec

func (r *MySQL) Exec(query string, args ...any) (sql.Result, error)

func (*MySQL) Ping

func (r *MySQL) Ping() error

func (*MySQL) Prepare

func (r *MySQL) Prepare(query string) (*sql.Stmt, error)

func (*MySQL) PrivilegesGrant

func (r *MySQL) PrivilegesGrant(user, database, host string) error

func (*MySQL) PrivilegesRevoke

func (r *MySQL) PrivilegesRevoke(user, database, host string) error

func (*MySQL) Query

func (r *MySQL) Query(query string, args ...any) (*sql.Rows, error)

func (*MySQL) QueryRow

func (r *MySQL) QueryRow(query string, args ...any) *sql.Row

func (*MySQL) UserCreate

func (r *MySQL) UserCreate(user, password, host string) error

func (*MySQL) UserDrop

func (r *MySQL) UserDrop(user, host string) error

func (*MySQL) UserPassword

func (r *MySQL) UserPassword(user, password, host string) error

func (*MySQL) UserPrivileges

func (r *MySQL) UserPrivileges(user, host string) ([]string, error)

func (*MySQL) Users

func (r *MySQL) Users() ([]types.MySQLUser, error)

type Postgres

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

func NewPostgres

func NewPostgres(username, password, address string, port uint) (*Postgres, error)

func (*Postgres) Close

func (r *Postgres) Close() error

func (*Postgres) DatabaseComment

func (r *Postgres) DatabaseComment(name, comment string) error

func (*Postgres) DatabaseCreate

func (r *Postgres) DatabaseCreate(name string) error

func (*Postgres) DatabaseDrop

func (r *Postgres) DatabaseDrop(name string) error

func (*Postgres) DatabaseExist

func (r *Postgres) DatabaseExist(name string) (bool, error)

func (*Postgres) DatabaseSize

func (r *Postgres) DatabaseSize(name string) (int64, error)

func (*Postgres) Databases

func (r *Postgres) Databases() ([]types.PostgresDatabase, error)

func (*Postgres) Exec

func (r *Postgres) Exec(query string, args ...any) (sql.Result, error)

func (*Postgres) Ping

func (r *Postgres) Ping() error

func (*Postgres) Prepare

func (r *Postgres) Prepare(query string) (*sql.Stmt, error)

func (*Postgres) PrivilegesGrant

func (r *Postgres) PrivilegesGrant(user, database string) error

func (*Postgres) PrivilegesRevoke

func (r *Postgres) PrivilegesRevoke(user, database string) error

func (*Postgres) Query

func (r *Postgres) Query(query string, args ...any) (*sql.Rows, error)

func (*Postgres) QueryRow

func (r *Postgres) QueryRow(query string, args ...any) *sql.Row

func (*Postgres) UserCreate

func (r *Postgres) UserCreate(user, password string) error

func (*Postgres) UserDrop

func (r *Postgres) UserDrop(user string) error

func (*Postgres) UserPassword

func (r *Postgres) UserPassword(user, password string) error

func (*Postgres) UserPrivileges

func (r *Postgres) UserPrivileges(user string) ([]string, error)

func (*Postgres) Users

func (r *Postgres) Users() ([]types.PostgresUser, error)

type Redis

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

func NewRedis

func NewRedis(username, password, address string) (*Redis, error)

func (*Redis) Clear

func (r *Redis) Clear() error

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) Data

func (r *Redis) Data(page, pageSize int) ([]RedisKV, error)

func (*Redis) Database

func (r *Redis) Database() (int, error)

func (*Redis) Exec

func (r *Redis) Exec(command string, args ...any) (any, error)

func (*Redis) Select

func (r *Redis) Select(db int) error

func (*Redis) Size

func (r *Redis) Size() (int, error)

type RedisKV

type RedisKV struct {
	Key       string    `json:"key"`
	Value     string    `json:"value"`
	Type      string    `json:"type"`
	Size      int64     `json:"size"`
	Length    int64     `json:"length"`
	TTL       int64     `json:"ttl"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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