codegen

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 14 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 (
	PdscDirectory string
	PackagePrefix string

	CommentWrapWidth = 120

	HeaderTemplate = template.Must(template.New("header").Parse(`DO NOT EDIT

Code automatically generated by go-restli
Source file: {{.SourceFilename}}`))
)

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 GenerateAllImportsFile added in v0.6.0

func GenerateAllImportsFile(outputDir string, codeFiles []*CodeFile)

func IfErrReturn

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

func PrivateIdentifier

func PrivateIdentifier(identifier string) string

func ReadJSONFromFile added in v0.7.0

func ReadJSONFromFile(filename string, s interface{}) error

func ReceiverName

func ReceiverName(typeName string) string

func RestLiMethod added in v0.2.0

func RestLiMethod(method protocol.RestLiMethod) *Statement

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 DeduplicateFiles added in v0.6.0

func DeduplicateFiles(files []*CodeFile) []*CodeFile

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
	}
}

func (*FieldTag) ToMap

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

type MalformedPdscFileError added in v0.7.1

type MalformedPdscFileError struct {
	Filename    string
	SyntaxError *json.SyntaxError
}

func (*MalformedPdscFileError) Error added in v0.7.1

func (m *MalformedPdscFileError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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