test_use_define_path

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code int
const (
	CodeOK Code = iota + 1
	CodeErr
	CodeFail
	CodeRange1  Code = 20001
	CodeRange2  Code = 20002
	CodeRange3  Code = 20003
	CodeRange4  Code = 20004
	CodeRange5  Code = 20204
	CodeRange6  Code = 20205
	CodeRange7  Code = 20206
	CodeRange8  Code = 20206
	CodeRange9  Code = 20301
	CodeRange10 Code = 20302
	CodeTe1     Code = 20310
	CodeTe2     Code = 20311
	CodeSe1     Code = 20400
	CodeSe2     Code = 20401
	CodeSe3     Code = 20410
	CodeSe4     Code = 20411
	CodeAe1     Code = 20420
	CodeAe2     Code = 20421
	CodeBe1     Code = 20430
	CodeBe2     Code = 20431
	CodeCe1     Code = 20440
	CodeCe2     Code = 20441
	CodeDe1     Code = 20450
	CodeDe2     Code = 20451
	CodeEe1     Code = 20460
	CodeEe2     Code = 20461
	CodeFe1     Code = 20470
	CodeFe2     Code = 20471
	CodeFe3     Code = 20472
	CodeGe1     Code = 20480
	CodeGe2     Code = 20481
	CodeXe1     Code = 20490
	CodeXe2     Code = 20491
	CodeXe3     Code = 20491
)

func (Code) Code added in v0.2.0

func (i Code) Code() int

Code get original type int value

func (Code) Error

func (i Code) Error() string

WARNING: You should use Trans, Lang, Wrap, WrapWithContext method instead

  • You should not use this method in an internationalized language environment, as well as method String.
  • Because this method always returns the translation value of the default language.
  • This method implements the error interface, so that you can return the value as an error,
  • If you understand the above mechanism then you can use this method with confidence

func (Code) IsLocaleSupport

func (i Code) IsLocaleSupport(locale string) bool

IsLocaleSupport Check if the specified locale is supported

func (Code) Lang

func (i Code) Lang(ctx context.Context, args ...interface{}) string

Lang get target translate text use context.Context

  • ctx context with Value use Key from _Code_ctxKey, which pass by i18n-stringer flag -ctxkey
  • args Optional placeholder replacement value, value type of Code, or type of string

func (Code) String

func (i Code) String() string

WARNING: You should use Trans, Lang, Wrap, WrapWithContext method instead

  • You should not use this method in an internationalized language environment, as well as method Error.
  • Because this method always returns the translation value of the default language.
  • This method implements the fmt.Stringer interface, so that you can output it directly by package fmt,
  • If you understand the above mechanism then you can use this method with confidence

func (Code) Trans

func (i Code) Trans(locale string, args ...interface{}) string

Trans get target translate text use specified language locale identifier

  • locale specified language locale identifier, need pass by IsLocaleSupport
  • args Optional placeholder replacement value, value type of Code, or type of string

func (Code) Wrap

func (i Code) Wrap(err error, locale string, args ...interface{}) *I18nCodeErrorWrap

Wrap another error with locale set for i18n TYPE Const

  • err another error
  • locale i18n locale name
  • args optional formatting component

func (Code) WrapWithContext

func (i Code) WrapWithContext(ctx context.Context, err error, args ...interface{}) *I18nCodeErrorWrap

WrapWithContext wrap another error with context.Context set for i18n TYPE Const

  • ctx context with Value use Key from _Code_ctxKey, which pass by i18n-stringer flag -ctxkey
  • err another error
  • args optional formatting component

type I18nCodeErrorWrap

type I18nCodeErrorWrap struct {
	// contains filtered or unexported fields
}

I18nCodeErrorWrap type i18n error wrapper

WARNING
This struct ONLY used to wrap the CONST generated by the i18n-stringer tool,
Pass easily obtain internationalized translations through Error, String, Translate
WARNING

func (*I18nCodeErrorWrap) Error

func (e *I18nCodeErrorWrap) Error() string

Error struct as error, get typed message wrap with inside error message

  • this method will be formatted wrap error if exist.
  • Only for development and debugging, or logging full error message
  • if you want to get typed message, please use method String or Translate

func (*I18nCodeErrorWrap) Format

func (e *I18nCodeErrorWrap) Format() string

Format alias for method Error

  • this method will be formatted wrap error if exist.
  • Only for development and debugging, or logging full error message
  • if you want to get typed message, please use method String or Translate

func (*I18nCodeErrorWrap) String

func (e *I18nCodeErrorWrap) String() string

String implement fmt.Stringer, get translated string use Translate

func (*I18nCodeErrorWrap) Translate

func (e *I18nCodeErrorWrap) Translate() string

Translate get translated string

func (*I18nCodeErrorWrap) Unwrap

func (e *I18nCodeErrorWrap) Unwrap() error

Unwrap an error. Get the error inside

func (*I18nCodeErrorWrap) Value

func (e *I18nCodeErrorWrap) Value() Code

Value get original type value

type I18nSingleErrorWrap

type I18nSingleErrorWrap struct {
	// contains filtered or unexported fields
}

I18nSingleErrorWrap type i18n error wrapper

WARNING
This struct ONLY used to wrap the CONST generated by the i18n-stringer tool,
Pass easily obtain internationalized translations through Error, String, Translate
WARNING

func (*I18nSingleErrorWrap) Error

func (e *I18nSingleErrorWrap) Error() string

Error struct as error, get typed message wrap with inside error message

  • this method will be formatted wrap error if exist.
  • Only for development and debugging, or logging full error message
  • if you want to get typed message, please use method String or Translate

func (*I18nSingleErrorWrap) Format

func (e *I18nSingleErrorWrap) Format() string

Format alias for method Error

  • this method will be formatted wrap error if exist.
  • Only for development and debugging, or logging full error message
  • if you want to get typed message, please use method String or Translate

func (*I18nSingleErrorWrap) String

func (e *I18nSingleErrorWrap) String() string

String implement fmt.Stringer, get translated string use Translate

func (*I18nSingleErrorWrap) Translate

func (e *I18nSingleErrorWrap) Translate() string

Translate get translated string

func (*I18nSingleErrorWrap) Unwrap

func (e *I18nSingleErrorWrap) Unwrap() error

Unwrap an error. Get the error inside

func (*I18nSingleErrorWrap) Value

func (e *I18nSingleErrorWrap) Value() Single

Value get original type value

type I18nTestErrorWrap

type I18nTestErrorWrap struct {
	// contains filtered or unexported fields
}

I18nTestErrorWrap type i18n error wrapper

WARNING
This struct ONLY used to wrap the CONST generated by the i18n-stringer tool,
Pass easily obtain internationalized translations through Error, String, Translate
WARNING

func (*I18nTestErrorWrap) Error

func (e *I18nTestErrorWrap) Error() string

Error struct as error, get typed message wrap with inside error message

  • this method will be formatted wrap error if exist.
  • Only for development and debugging, or logging full error message
  • if you want to get typed message, please use method String or Translate

func (*I18nTestErrorWrap) Format

func (e *I18nTestErrorWrap) Format() string

Format alias for method Error

  • this method will be formatted wrap error if exist.
  • Only for development and debugging, or logging full error message
  • if you want to get typed message, please use method String or Translate

func (*I18nTestErrorWrap) String

func (e *I18nTestErrorWrap) String() string

String implement fmt.Stringer, get translated string use Translate

func (*I18nTestErrorWrap) Translate

func (e *I18nTestErrorWrap) Translate() string

Translate get translated string

func (*I18nTestErrorWrap) Unwrap

func (e *I18nTestErrorWrap) Unwrap() error

Unwrap an error. Get the error inside

func (*I18nTestErrorWrap) Value

func (e *I18nTestErrorWrap) Value() Test

Value get original type value

type Single

type Single int
const (
	Sig01 Single = iota + 300
	Sig02
	Sig03
	Sig04
	Sig05
	Sig06
	Sig07
	Sig08
	Sig09
	Sig10
	Sig11
	Sig12
	Sig13
	Sig14
	Sig15
	Sig16
	Sig17
	Sig18
	Sig19
	Sig20
	Sig21
	Sig22
	Sig23
	Sig24
)

func (Single) Code added in v0.2.0

func (i Single) Code() int

Code get original type int value

func (Single) Error

func (i Single) Error() string

WARNING: You should use Trans, Lang, Wrap, WrapWithContext method instead

  • You should not use this method in an internationalized language environment, as well as method String.
  • Because this method always returns the translation value of the default language.
  • This method implements the error interface, so that you can return the value as an error,
  • If you understand the above mechanism then you can use this method with confidence

func (Single) IsLocaleSupport

func (i Single) IsLocaleSupport(locale string) bool

IsLocaleSupport Check if the specified locale is supported

func (Single) Lang

func (i Single) Lang(ctx context.Context, args ...interface{}) string

Lang get target translate text use context.Context

  • ctx context with Value use Key from _Single_ctxKey, which pass by i18n-stringer flag -ctxkey
  • args Optional placeholder replacement value, value type of Single, or type of string

func (Single) String

func (i Single) String() string

WARNING: You should use Trans, Lang, Wrap, WrapWithContext method instead

  • You should not use this method in an internationalized language environment, as well as method Error.
  • Because this method always returns the translation value of the default language.
  • This method implements the fmt.Stringer interface, so that you can output it directly by package fmt,
  • If you understand the above mechanism then you can use this method with confidence

func (Single) Trans

func (i Single) Trans(locale string, args ...interface{}) string

Trans get target translate text use specified language locale identifier

  • locale specified language locale identifier, need pass by IsLocaleSupport
  • args Optional placeholder replacement value, value type of Single, or type of string

func (Single) Wrap

func (i Single) Wrap(err error, locale string, args ...interface{}) *I18nSingleErrorWrap

Wrap another error with locale set for i18n TYPE Const

  • err another error
  • locale i18n locale name
  • args optional formatting component

func (Single) WrapWithContext

func (i Single) WrapWithContext(ctx context.Context, err error, args ...interface{}) *I18nSingleErrorWrap

WrapWithContext wrap another error with context.Context set for i18n TYPE Const

  • ctx context with Value use Key from _Single_ctxKey, which pass by i18n-stringer flag -ctxkey
  • err another error
  • args optional formatting component

type Test

type Test int
const (
	TestCase01 Test = iota + 10
	TestCase02
	TestCase03
	TestCase04 Test = 1001
	TestCase05 Test = 1002
	TestCase06 Test = 1003
)

func (Test) Code added in v0.2.0

func (i Test) Code() int

Code get original type int value

func (Test) Error

func (i Test) Error() string

WARNING: You should use Trans, Lang, Wrap, WrapWithContext method instead

  • You should not use this method in an internationalized language environment, as well as method String.
  • Because this method always returns the translation value of the default language.
  • This method implements the error interface, so that you can return the value as an error,
  • If you understand the above mechanism then you can use this method with confidence

func (Test) IsLocaleSupport

func (i Test) IsLocaleSupport(locale string) bool

IsLocaleSupport Check if the specified locale is supported

func (Test) Lang

func (i Test) Lang(ctx context.Context, args ...interface{}) string

Lang get target translate text use context.Context

  • ctx context with Value use Key from _Test_ctxKey, which pass by i18n-stringer flag -ctxkey
  • args Optional placeholder replacement value, value type of Test, or type of string

func (Test) String

func (i Test) String() string

WARNING: You should use Trans, Lang, Wrap, WrapWithContext method instead

  • You should not use this method in an internationalized language environment, as well as method Error.
  • Because this method always returns the translation value of the default language.
  • This method implements the fmt.Stringer interface, so that you can output it directly by package fmt,
  • If you understand the above mechanism then you can use this method with confidence

func (Test) Trans

func (i Test) Trans(locale string, args ...interface{}) string

Trans get target translate text use specified language locale identifier

  • locale specified language locale identifier, need pass by IsLocaleSupport
  • args Optional placeholder replacement value, value type of Test, or type of string

func (Test) Wrap

func (i Test) Wrap(err error, locale string, args ...interface{}) *I18nTestErrorWrap

Wrap another error with locale set for i18n TYPE Const

  • err another error
  • locale i18n locale name
  • args optional formatting component

func (Test) WrapWithContext

func (i Test) WrapWithContext(ctx context.Context, err error, args ...interface{}) *I18nTestErrorWrap

WrapWithContext wrap another error with context.Context set for i18n TYPE Const

  • ctx context with Value use Key from _Test_ctxKey, which pass by i18n-stringer flag -ctxkey
  • err another error
  • args optional formatting component

Jump to

Keyboard shortcuts

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