db

package
v2.2.27 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: AGPL-3.0 Imports: 9 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 (m *MySQL) Close() error

func (*MySQL) DatabaseCreate

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

func (*MySQL) DatabaseDrop

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

func (*MySQL) Databases

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

func (*MySQL) Exec

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

func (*MySQL) Ping

func (m *MySQL) Ping() error

func (*MySQL) Prepare

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

func (*MySQL) PrivilegesGrant

func (m *MySQL) PrivilegesGrant(user, database string) error

func (*MySQL) PrivilegesRevoke

func (m *MySQL) PrivilegesRevoke(user, database string) error

func (*MySQL) Query

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

func (*MySQL) QueryRow

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

func (*MySQL) UserCreate

func (m *MySQL) UserCreate(user, password string) error

func (*MySQL) UserDrop

func (m *MySQL) UserDrop(user string) error

func (*MySQL) UserPassword

func (m *MySQL) UserPassword(user, password string) error

func (*MySQL) Users

func (m *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 (m *Postgres) Close() error

func (*Postgres) DatabaseCreate

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

func (*Postgres) DatabaseDrop

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

func (*Postgres) Databases

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

func (*Postgres) Exec

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

func (*Postgres) HostAdd

func (m *Postgres) HostAdd(database, user, host string) error

func (*Postgres) HostRemove

func (m *Postgres) HostRemove(database, user, host string) error

func (*Postgres) Ping

func (m *Postgres) Ping() error

func (*Postgres) Prepare

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

func (*Postgres) PrivilegesGrant

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

func (*Postgres) PrivilegesRevoke

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

func (*Postgres) Query

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

func (*Postgres) QueryRow

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

func (*Postgres) UserCreate

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

func (*Postgres) UserDrop

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

func (*Postgres) UserPassword

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

func (*Postgres) Users

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

Jump to

Keyboard shortcuts

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