Documentation ¶
Index ¶
- func L(dst io.Writer, s string, args ...interface{})
- func LL(dst io.Writer, s string, args ...interface{})
- func R(dst io.Writer, s string, args ...interface{})
- func RegisterZeroVal(typ, val string)
- func Write(dst io.Writer, src io.Reader, options ...Option) error
- func WriteFile(filename string, src io.Reader, options ...Option) error
- func WriteImports(dst io.Writer, pkgs ...ImportPkg) error
- func ZeroVal(typ string) string
- type CodeFormatError
- type ConstantField
- func (f *ConstantField) Bool(s string) bool
- func (f *ConstantField) GetterMethod(exported bool) string
- func (f *ConstantField) IsConstant() bool
- func (f *ConstantField) IsRequired() bool
- func (f *ConstantField) JSON() string
- func (f *ConstantField) MustBool(s string) bool
- func (f *ConstantField) MustString(s string) string
- func (f *ConstantField) Organize()
- func (f *ConstantField) SkipMethod() bool
- func (f *ConstantField) String(s string) string
- func (f *ConstantField) Type() string
- func (f *ConstantField) UnmarshalJSON(data []byte) error
- func (f *ConstantField) Value() interface{}
- type Field
- type FieldList
- type ImportPkg
- type Object
- func (o *Object) AddField(f Field)
- func (o *Object) ArrayOf() string
- func (o *Object) Bool(name string) bool
- func (b *Object) Comment() string
- func (b *Object) Extra(s string) (interface{}, bool)
- func (o *Object) Fields() []Field
- func (b *Object) Initialize()
- func (o *Object) MustBool(name string) bool
- func (o *Object) MustString(name string) string
- func (b *Object) Name(exported bool) string
- func (o *Object) ObjectOf() string
- func (o *Object) Organize()
- func (o *Object) String(name string) string
- func (o *Object) UnmarshalJSON(data []byte) error
- type Option
- type Output
- func (o *Output) L(s string, args ...interface{})
- func (o *Output) LL(s string, args ...interface{})
- func (o *Output) R(s string, args ...interface{})
- func (o *Output) Write(dst io.Writer, options ...Option) error
- func (o *Output) WriteFile(fn string, options ...Option) error
- func (o *Output) WriteImportPkgs(pkgs ...ImportPkg) error
- func (o *Output) WriteImports(urls ...string) error
- func (o *Output) WritePackage(s string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterZeroVal ¶ added in v1.0.3
func RegisterZeroVal(typ, val string)
Types ¶
type CodeFormatError ¶
type CodeFormatError struct {
// contains filtered or unexported fields
}
func (CodeFormatError) Error ¶
func (err CodeFormatError) Error() string
func (CodeFormatError) Source ¶
func (err CodeFormatError) Source() string
Returns the source code with line numbers
type ConstantField ¶ added in v1.0.3
type ConstantField struct {
// contains filtered or unexported fields
}
func (*ConstantField) Bool ¶ added in v1.0.4
func (f *ConstantField) Bool(s string) bool
func (*ConstantField) GetterMethod ¶ added in v1.0.3
func (*ConstantField) IsConstant ¶ added in v1.0.3
func (f *ConstantField) IsConstant() bool
func (*ConstantField) IsRequired ¶ added in v1.0.3
func (f *ConstantField) IsRequired() bool
func (*ConstantField) MustBool ¶ added in v1.0.4
func (f *ConstantField) MustBool(s string) bool
func (*ConstantField) MustString ¶ added in v1.0.4
func (f *ConstantField) MustString(s string) string
func (*ConstantField) SkipMethod ¶ added in v1.0.3
func (f *ConstantField) SkipMethod() bool
func (*ConstantField) String ¶ added in v1.0.4
func (f *ConstantField) String(s string) string
func (*ConstantField) UnmarshalJSON ¶ added in v1.0.3
func (f *ConstantField) UnmarshalJSON(data []byte) error
func (*ConstantField) Value ¶ added in v1.0.3
func (f *ConstantField) Value() interface{}
type Field ¶ added in v1.0.3
type Field interface { Organize() SkipMethod() bool // Name of the field. Can be exported or not exported Name(bool) string // The Go type Type() string // The JSON key used JSON() string GetterMethod(bool) string Comment() string Extra(string) (interface{}, bool) IsRequired() bool IsConstant() bool Bool(string) bool MustBool(string) bool String(string) string MustString(string) string }
type FieldList ¶ added in v1.0.3
type FieldList []Field
func (*FieldList) UnmarshalJSON ¶ added in v1.0.3
type Object ¶ added in v1.0.3
type Object struct {
// contains filtered or unexported fields
}
func (*Object) Initialize ¶ added in v1.0.3
func (b *Object) Initialize()
func (*Object) MustString ¶ added in v1.0.4
func (*Object) String ¶ added in v1.0.4
Returns the value of field `name` as a string. Returns empty value if the object stored in the field is not a string
func (*Object) UnmarshalJSON ¶ added in v1.0.3
type Output ¶ added in v1.0.2
type Output struct {
// contains filtered or unexported fields
}
func (*Output) WriteImportPkgs ¶ added in v1.0.4
func (*Output) WriteImports ¶ added in v1.0.2
func (*Output) WritePackage ¶ added in v1.0.4
Click to show internal directories.
Click to hide internal directories.