sqlstring

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 7 Imported by: 0

README

sqlstring

Simple SQL escape and format

Escaping sql values

//Format
sql := sqlstring.Format("select * from users where name=? and age=? limit ?,?", "t'est", 10, 10, 10)

fmt.Printf("sql: %s",sql)

//Escape
sql = "select * from users WHERE name = " + sqlstring.Escape(name);
fmt.Printf("sql: %s",sql)

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(val interface{}) string

Escape escape the val for sql

func EscapeInLocation

func EscapeInLocation(val interface{}, loc *time.Location) string

EscapeInLocation escape the val with time.Location

func Format

func Format(query string, args ...interface{}) string

Format format the sql with args

func FormatInLocation

func FormatInLocation(query string, loc *time.Location, args ...interface{}) string

FormatInLocation format the sql with args

Types

This section is empty.

Jump to

Keyboard shortcuts

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