mysql

package
v0.0.0-...-45b38f9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mysql provides a MySQL client to interact with a MySQL server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

Client is a MySQL client.

func NewClient

func NewClient(opts Options) (*Client, error)

NewClient returns a new MySQL client.

func (*Client) AlterTable

func (c *Client) AlterTable() error

AlterTable alters the table.

func (*Client) CreateDB

func (c *Client) CreateDB() error

CreateDB creates a database.

func (*Client) CreateTable

func (c *Client) CreateTable() error

CreateTable creates a table.

func (*Client) DeleteFromTable

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

DeleteFromTable deletes a row from the table.

func (*Client) DropDB

func (c *Client) DropDB() error

DropDB drops the database.

func (*Client) DropTable

func (c *Client) DropTable() error

DropTable drops the table.

func (*Client) InsertIntoTable

func (c *Client) InsertIntoTable(name string, population int) error

InsertIntoTable inserts a row into the table.

func (*Client) SelectAllFromTable

func (c *Client) SelectAllFromTable() error

SelectAllFromTable select all rows from the table.

func (*Client) SelectFromTable

func (c *Client) SelectFromTable(name string) (int, error)

SelectFromTable selects a row from the table.

func (*Client) UpdateTable

func (c *Client) UpdateTable(srcName, newName string, newPopulation int) error

UpdateTable updates a row in the table.

type Options

type Options struct {
	ServerAddress string
	Username      string
	Password      string
	DatabaseName  string
	Dialer        *net.Dialer
	WithTLS       bool
}

Options contains the options to connect to a MySQL server.

Jump to

Keyboard shortcuts

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