Documentation ¶
Index ¶
- func Initialize(allowNativePassword bool) (*sql.DB, error)
- func Insert(databaseHandler *sql.DB, table string, columns []string, ...) (int, error)
- func PingDatabase(databaseHandler *sql.DB) (bool, error)
- func Replace(databaseHandler *sql.DB, table string, columns []string, ...) (int, error)
- func Select(databaseHandler *sql.DB, columns []string, table string, condition string, ...) ([]map[string]interface{}, error)
- func Update(databaseHandler *sql.DB, table string, columns []string, condition string, ...) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Initialize ¶
MySql database connection initializer
func Insert ¶ added in v0.1.8
func Insert(databaseHandler *sql.DB, table string, columns []string, inputParameters ...any) (int, error)
Insert into MySql table. On success update this method will return how many rows affected. Please put your parameter placeholders values in inputParameters to prevent SQL Injection.
func Replace ¶ added in v0.1.13
func Replace(databaseHandler *sql.DB, table string, columns []string, inputParameters ...any) (int, error)
Replace into MySql table. On success update this method will return how many rows affected. Please put your parameter placeholders values in inputParameters to prevent SQL Injection.
func Select ¶
func Select(databaseHandler *sql.DB, columns []string, table string, condition string, inputParameters ...any) ([]map[string]interface{}, error)
MySql select query for multiple rows of data. Please put your parameter placeholders in inputParameters to prevent SQL Injection.
func Update ¶ added in v0.1.2
func Update(databaseHandler *sql.DB, table string, columns []string, condition string, inputParameters ...any) (int, error)
Update MySql table. On success update this method will return how many rows updated. Please put your parameter placeholders values in inputParameters to prevent SQL Injection.
Types ¶
This section is empty.