language

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 7 Imported by: 1

README

language

Languages codes

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexToCode

func IndexToCode(index Index) string

IndexToCode returns language code.

func IsLanguageName

func IsLanguageName(b []byte) bool

func Supported

func Supported() []string

Supported returns code of supported languages.

func TranslationResource

func TranslationResource(dir string, langfilename string, customSuffixes ...string) ([]string, error)

Types

type Index

type Index int

Index is integer representative of language short code.

const Unknown Index = -1

Unknown used if language code is not found.

func ToIndex

func ToIndex(lang string) Index

ToIndex returns index by language code: ru, en, sr, cz...

type Name

type Name []string

Name holds decoded names. Index of the slice calculates by ToIndex().

func ToName

func ToName(b []byte) (Name, error)

Name decodes jsonb into array of strings

func (*Name) Byte

func (rn *Name) Byte() []byte

func (*Name) MarshalJSON

func (n *Name) MarshalJSON() ([]byte, error)

func (*Name) Scan

func (n *Name) Scan(value interface{}) error

Scan implements database/sql Scanner interface.

func (*Name) UnmarshalJSON

func (n *Name) UnmarshalJSON(buf []byte) error

func (*Name) Value

func (n *Name) Value() (driver.Value, error)

Value implements interface sql.Valuer

type NameColumn

type NameColumn []byte

NameColumn is a type of column Name in regular reference table

func (NameColumn) Name

func (rn NameColumn) Name() (Name, error)

Name decodes jsonb into array of strings

Jump to

Keyboard shortcuts

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