charset

package
v0.0.0-...-3056823 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CharsetBin is used for marking binary charset.
	CharsetBin = "binary"
	// CollationBin is the default collation for CharsetBin.
	CollationBin = "binary"
)

Variables

This section is empty.

Functions

func GetCharsetInfo

func GetCharsetInfo(cs string) (string, string, error)

GetCharsetInfo returns charset and collation for cs as name.

func GetDefaultCollation

func GetDefaultCollation(charset string) (string, error)

GetDefaultCollation returns the default collation for charset.

func Lookup

func Lookup(label string) (e encoding.Encoding, name string)

Lookup returns the encoding with the specified label, and its canonical name. It returns nil and the empty string if label is not one of the standard encodings for HTML. Matching is case-insensitive and ignores leading and trailing whitespace.

func ValidCharsetAndCollation

func ValidCharsetAndCollation(cs string, co string) bool

ValidCharsetAndCollation checks the charset and the collation validity and returns a boolean.

Types

type Charset

type Charset struct {
	Name             string
	DefaultCollation *Collation
	Collations       map[string]*Collation
	Desc             string
	Maxlen           int
}

Charset is a charset. Now we only support MySQL.

type Collation

type Collation struct {
	ID          int
	CharsetName string
	Name        string
	IsDefault   bool
}

Collation is a collation. Now we only support MySQL.

func GetCollations

func GetCollations() []*Collation

GetCollations returns a list for all collations.

type Desc

type Desc struct {
	Name             string
	Desc             string
	DefaultCollation string
	Maxlen           int
}

Desc is a charset description.

func GetAllCharsets

func GetAllCharsets() []*Desc

GetAllCharsets gets all charset descriptions in the local charsets.

Jump to

Keyboard shortcuts

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