codegen

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncodingJson  = "encoding/json"
	Unmarshal     = "Unmarshal"
	UnmarshalJSON = "UnmarshalJSON"
	Marshal       = "Marshal"
	MarshalJSON   = "MarshalJSON"

	Codec                = "codec"
	RestLiEncode         = "RestLiEncode"
	RestLiDecode         = "RestLiDecode"
	RestLiCodec          = "RestLiCodec"
	RestLiUrlEncoder     = "RestLiUrlEncoder"
	RestLiReducedEncoder = "RestLiReducedEncoder"

	PopulateDefaultValues = "populateDefaultValues"
	ValidateUnionFields   = "validateUnionFields"

	NetHttp = "net/http"

	ProtocolPackage = "github.com/PapaCharlie/go-restli/protocol"
)

Variables

View Source
var (
	CommentWrapWidth = 120
)

Functions

func AddFuncOnReceiver

func AddFuncOnReceiver(def *Statement, receiver, typeName, funcName string) *Statement

func AddMarshalJSON

func AddMarshalJSON(def *Statement, receiver, typeName string, f func(def *Group)) *Statement

func AddRestLiDecode

func AddRestLiDecode(def *Statement, receiver, typeName string, f func(def *Group)) *Statement

func AddRestLiEncode

func AddRestLiEncode(def *Statement, receiver, typeName string, f func(def *Group)) *Statement

func AddStringer

func AddStringer(def *Statement, receiver, typeName string, f func(def *Group)) *Statement

func AddUnmarshalJSON

func AddUnmarshalJSON(def *Statement, receiver, typeName string, f func(def *Group)) *Statement

func AddWordWrappedComment

func AddWordWrappedComment(code *Statement, comment string) *Statement

func Bytes

func Bytes() *Statement

func ExportedIdentifier

func ExportedIdentifier(identifier string) string

func GetPackagePrefix

func GetPackagePrefix() string

func IfErrReturn

func IfErrReturn(def *Group, results ...Code) *Group

func PrivateIdentifier

func PrivateIdentifier(identifier string) string

func ReceiverName

func ReceiverName(typeName string) string

func RestLiMethod added in v0.2.0

func RestLiMethod(method protocol.RestLiMethod) *Statement

func SetPackagePrefix

func SetPackagePrefix(prefix string)

func Write added in v0.1.2

func Write(filename string, file *File) error

Types

type CodeFile

type CodeFile struct {
	SourceFilename string
	PackagePath    string
	Filename       string
	Code           *Statement
}

func NewCodeFile

func NewCodeFile(filename string, packageSegments ...string) *CodeFile

func (*CodeFile) Identifier added in v0.1.2

func (f *CodeFile) Identifier() string

func (*CodeFile) Write

func (f *CodeFile) Write(outputDir string) (filename string, err error)

type FieldTag

type FieldTag struct {
	Json struct {
		Name     string
		Optional bool
	}
	RestLi struct {
		Union bool
	}
}

func (*FieldTag) ToMap

func (f *FieldTag) ToMap() map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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