Help us shape the future of Go! Take the 2026 Go Developer Survey

database

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionConfig

type ConnectionConfig struct {
	Type      string `json:"type"`
	Host      string `json:"host"`
	Port      int    `json:"port"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Database  string `json:"database,omitempty"`
	Container string `json:"container,omitempty"`
}

type DatabaseInfo

type DatabaseInfo struct {
	Name   string `json:"name"`
	Size   string `json:"size,omitempty"`
	Tables int    `json:"tables,omitempty"`
}

type Manager

type Manager struct{}

func NewManager

func NewManager() *Manager

func (*Manager) CreateDatabase

func (m *Manager) CreateDatabase(cfg *ConnectionConfig, dbName string) error

func (*Manager) CreateUser

func (m *Manager) CreateUser(cfg *ConnectionConfig, username, password, host string) error

func (*Manager) GrantPrivileges

func (m *Manager) GrantPrivileges(cfg *ConnectionConfig, username, database, host string) error

func (*Manager) ListDatabases

func (m *Manager) ListDatabases(cfg *ConnectionConfig) ([]DatabaseInfo, error)

func (*Manager) ListTables

func (m *Manager) ListTables(cfg *ConnectionConfig, database string) ([]TableInfo, error)

func (*Manager) ListUsers

func (m *Manager) ListUsers(cfg *ConnectionConfig) ([]UserInfo, error)

func (*Manager) TestConnection

func (m *Manager) TestConnection(cfg *ConnectionConfig) error

type TableInfo

type TableInfo struct {
	Name   string `json:"name"`
	Rows   int64  `json:"rows,omitempty"`
	Size   string `json:"size,omitempty"`
	Engine string `json:"engine,omitempty"`
}

type UserInfo

type UserInfo struct {
	Name string `json:"name"`
	Host string `json:"host,omitempty"`
}

Jump to

Keyboard shortcuts

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