database

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryForMySQL = "SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE();"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	ColumnName string
	FieldName  string
}

Column holds ColumnName.

FieldName is upper camel case of ColumnName.

type DB

type DB interface {
	// Query executes the given query with args.
	Query(query string, args ...interface{}) (*sql.Rows, error)
}

DB is an interface to execute queries.

type Table

type Table struct {
	TableName string
	FieldName string
	Columns   []Column
}

Table holds TableName and Columns.

FieldName is upper camel case of TableName.

func GetTables

func GetTables(db DB, query string) (tables []Table, returnErr error)

GetTables gets all Table from the database by the given query.

The returning slice of Table is sorted by table name.

Jump to

Keyboard shortcuts

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