sqlstring

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 8 Imported by: 6

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

func SetSingleQuoteEscaper added in v0.2.2

func SetSingleQuoteEscaper(escaper string)

SetSingleQuoteEscaper set the singleQuoteEscaper default:\' , e.g. ” 、 \'

Types

This section is empty.

Jump to

Keyboard shortcuts

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