luci: go.chromium.org/luci/common/data/text/templateproto Index | Files

package templateproto

import "go.chromium.org/luci/common/data/text/templateproto"

Package templateproto defines a proto-based way to configure templates for JSON documents.

Index

Package Files

doc.go gen.go loader.go normalize.go render.go template.pb.go

Variables

var ParamRegex = regexp.MustCompile(`^\${[^}]+}$`)

ParamRegex is the regular expression that all parameter names must match.

func NormalizeJSON Uses

func NormalizeJSON(data string, obj bool) (string, error)

NormalizeJSON is used to take some free-form JSON and validates that:

* it only contains a valid JSON object (e.g. `{...stuff...}`); OR
* it only contains a valid JSON array (e.g. `[...stuff...]`)

If obj is true, this looks for an object, if it's false, it looks for an array.

This will also remove all extra whitespace and sort all objects by key.

type File Uses

type File struct {
    Template             map[string]*File_Template `protobuf:"bytes,1,rep,name=template,proto3" json:"template,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}                  `json:"-"`
    XXX_unrecognized     []byte                    `json:"-"`
    XXX_sizecache        int32                     `json:"-"`
}

File represents a file full of template definitions.

func LoadFile Uses

func LoadFile(data string) (file *File, err error)

LoadFile loads a File from a string containing the template text protobuf.

Expects config.Interface to be in the context already.

func (*File) Descriptor Uses

func (*File) Descriptor() ([]byte, []int)

func (*File) GetTemplate Uses

func (m *File) GetTemplate() map[string]*File_Template

func (*File) Normalize Uses

func (f *File) Normalize() error

Normalize will normalize all of the Templates in this message, returning an error if any are invalid.

func (*File) ProtoMessage Uses

func (*File) ProtoMessage()

func (*File) Render Uses

func (f *File) Render(spec *Specifier) (string, error)

Render renders the specified template with the given parameters.

func (*File) RenderL Uses

func (f *File) RenderL(templName string, params LiteralMap) (ret string, err error)

RenderL renders a specified template with go literal arguments.

func (*File) Reset Uses

func (m *File) Reset()

func (*File) String Uses

func (m *File) String() string

func (*File) XXX_DiscardUnknown Uses

func (m *File) XXX_DiscardUnknown()

func (*File) XXX_Marshal Uses

func (m *File) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*File) XXX_Merge Uses

func (m *File) XXX_Merge(src proto.Message)

func (*File) XXX_Size Uses

func (m *File) XXX_Size() int

func (*File) XXX_Unmarshal Uses

func (m *File) XXX_Unmarshal(b []byte) error

type File_Template Uses

type File_Template struct {
    // Markdown-formatted documentation for this schema entry.
    Doc string `protobuf:"bytes,1,opt,name=doc,proto3" json:"doc,omitempty"`
    // body is the main JSON output for this template. It must have the form
    // of valid json, modulo the substitution parameters. In order for this
    // Template to be valid, body must parse as valid JSON, after all
    // substitutions have been applied.
    Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
    // param is a listing of all of the parameterized bits in the Template body.
    // The key must match the regex /\${[^}]+}/. So "${foo}" would be ok, but
    // "foo", "$foo", or "${}" would not.
    //
    // params provided here must be present in Body at least once in order
    // for the Template to be valid.
    Param                map[string]*File_Template_Parameter `protobuf:"bytes,3,rep,name=param,proto3" json:"param,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}                            `json:"-"`
    XXX_unrecognized     []byte                              `json:"-"`
    XXX_sizecache        int32                               `json:"-"`
}

Template defines a single template.

func (*File_Template) Descriptor Uses

func (*File_Template) Descriptor() ([]byte, []int)

func (*File_Template) GetBody Uses

func (m *File_Template) GetBody() string

func (*File_Template) GetDoc Uses

func (m *File_Template) GetDoc() string

func (*File_Template) GetParam Uses

func (m *File_Template) GetParam() map[string]*File_Template_Parameter

func (*File_Template) Normalize Uses

func (t *File_Template) Normalize() error

Normalize will normalize the Template message, returning an error if it is invalid.

func (*File_Template) ProtoMessage Uses

func (*File_Template) ProtoMessage()

func (*File_Template) Render Uses

func (t *File_Template) Render(params map[string]*Value) (string, error)

Render turns the Template into a JSON document, filled with the given parameters. It does not validate that the output is valid JSON, but if you called Normalize on this Template already, then it WILL be valid JSON.

func (*File_Template) RenderL Uses

func (t *File_Template) RenderL(m LiteralMap) (string, error)

RenderL renders this template with a LiteralMap, calling its Convert method and passing the result to Render.

func (*File_Template) Reset Uses

func (m *File_Template) Reset()

func (*File_Template) String Uses

func (m *File_Template) String() string

func (*File_Template) XXX_DiscardUnknown Uses

func (m *File_Template) XXX_DiscardUnknown()

func (*File_Template) XXX_Marshal Uses

func (m *File_Template) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*File_Template) XXX_Merge Uses

func (m *File_Template) XXX_Merge(src proto.Message)

func (*File_Template) XXX_Size Uses

func (m *File_Template) XXX_Size() int

func (*File_Template) XXX_Unmarshal Uses

func (m *File_Template) XXX_Unmarshal(b []byte) error

type File_Template_Parameter Uses

type File_Template_Parameter struct {
    // Markdown-formatted documentation for this schema entry.
    Doc     string `protobuf:"bytes,1,opt,name=doc,proto3" json:"doc,omitempty"`
    Default *Value `protobuf:"bytes,2,opt,name=default,proto3" json:"default,omitempty"`
    // nullable indicates if 'null' is a valid value for this parameter. This
    // can be used to distinguish e.g. "" from not-supplied. If default is
    // Value{null: {}}, this must be true.
    Nullable             bool     `protobuf:"varint,3,opt,name=nullable,proto3" json:"nullable,omitempty"`
    Schema               *Schema  `protobuf:"bytes,4,opt,name=schema,proto3" json:"schema,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*File_Template_Parameter) Accepts Uses

func (p *File_Template_Parameter) Accepts(v *Value) error

Accepts returns nil if this Parameter can accept the Value.

func (*File_Template_Parameter) Descriptor Uses

func (*File_Template_Parameter) Descriptor() ([]byte, []int)

func (*File_Template_Parameter) GetDefault Uses

func (m *File_Template_Parameter) GetDefault() *Value

func (*File_Template_Parameter) GetDoc Uses

func (m *File_Template_Parameter) GetDoc() string

func (*File_Template_Parameter) GetNullable Uses

func (m *File_Template_Parameter) GetNullable() bool

func (*File_Template_Parameter) GetSchema Uses

func (m *File_Template_Parameter) GetSchema() *Schema

func (*File_Template_Parameter) Normalize Uses

func (p *File_Template_Parameter) Normalize() error

Normalize will normalize the Parameter, returning an error if it is invalid.

func (*File_Template_Parameter) ProtoMessage Uses

func (*File_Template_Parameter) ProtoMessage()

func (*File_Template_Parameter) Reset Uses

func (m *File_Template_Parameter) Reset()

func (*File_Template_Parameter) String Uses

func (m *File_Template_Parameter) String() string

func (*File_Template_Parameter) XXX_DiscardUnknown Uses

func (m *File_Template_Parameter) XXX_DiscardUnknown()

func (*File_Template_Parameter) XXX_Marshal Uses

func (m *File_Template_Parameter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*File_Template_Parameter) XXX_Merge Uses

func (m *File_Template_Parameter) XXX_Merge(src proto.Message)

func (*File_Template_Parameter) XXX_Size Uses

func (m *File_Template_Parameter) XXX_Size() int

func (*File_Template_Parameter) XXX_Unmarshal Uses

func (m *File_Template_Parameter) XXX_Unmarshal(b []byte) error

type LiteralMap Uses

type LiteralMap map[string]interface{}

LiteralMap is a type for literal in-line param substitutions, or when you know statically that the params correspond to correct Value types.

func (LiteralMap) Convert Uses

func (m LiteralMap) Convert() (map[string]*Value, error)

Convert converts this to a parameter map that can be used with Template.Render.

type Schema Uses

type Schema struct {
    // Types that are valid to be assigned to Schema:
    //	*Schema_Int
    //	*Schema_Uint
    //	*Schema_Float
    //	*Schema_Bool
    //	*Schema_Str
    //	*Schema_Bytes
    //	*Schema_Enum
    //	*Schema_Object
    //	*Schema_Array
    Schema               isSchema_Schema `protobuf_oneof:"schema"`
    XXX_NoUnkeyedLiteral struct{}        `json:"-"`
    XXX_unrecognized     []byte          `json:"-"`
    XXX_sizecache        int32           `json:"-"`
}

func (*Schema) Accepts Uses

func (s *Schema) Accepts(v *Value) error

Accepts returns nil if this Schema can accept the Value.

func (*Schema) Descriptor Uses

func (*Schema) Descriptor() ([]byte, []int)

func (*Schema) GetArray Uses

func (m *Schema) GetArray() *Schema_JSON

func (*Schema) GetBool Uses

func (m *Schema) GetBool() *Schema_Atom

func (*Schema) GetBytes Uses

func (m *Schema) GetBytes() *Schema_Sequence

func (*Schema) GetEnum Uses

func (m *Schema) GetEnum() *Schema_Set

func (*Schema) GetFloat Uses

func (m *Schema) GetFloat() *Schema_Atom

func (*Schema) GetInt Uses

func (m *Schema) GetInt() *Schema_Atom

func (*Schema) GetObject Uses

func (m *Schema) GetObject() *Schema_JSON

func (*Schema) GetSchema Uses

func (m *Schema) GetSchema() isSchema_Schema

func (*Schema) GetStr Uses

func (m *Schema) GetStr() *Schema_Sequence

func (*Schema) GetUint Uses

func (m *Schema) GetUint() *Schema_Atom

func (*Schema) Normalize Uses

func (s *Schema) Normalize() error

Normalize will normalize the Schema, returning an error if it is invalid.

func (*Schema) ProtoMessage Uses

func (*Schema) ProtoMessage()

func (*Schema) Reset Uses

func (m *Schema) Reset()

func (*Schema) String Uses

func (m *Schema) String() string

func (*Schema) XXX_DiscardUnknown Uses

func (m *Schema) XXX_DiscardUnknown()

func (*Schema) XXX_Marshal Uses

func (m *Schema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Schema) XXX_Merge Uses

func (m *Schema) XXX_Merge(src proto.Message)

func (*Schema) XXX_OneofFuncs Uses

func (*Schema) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*Schema) XXX_Size Uses

func (m *Schema) XXX_Size() int

func (*Schema) XXX_Unmarshal Uses

func (m *Schema) XXX_Unmarshal(b []byte) error

func (*Schema) Zero Uses

func (s *Schema) Zero() *Value

Zero produces a Value from this schema which is a valid 'zero' value (in the go sense)

type Schema_Array Uses

type Schema_Array struct {
    Array *Schema_JSON `protobuf:"bytes,9,opt,name=array,proto3,oneof"`
}

type Schema_Atom Uses

type Schema_Atom struct {
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*Schema_Atom) Descriptor Uses

func (*Schema_Atom) Descriptor() ([]byte, []int)

func (*Schema_Atom) ProtoMessage Uses

func (*Schema_Atom) ProtoMessage()

func (*Schema_Atom) Reset Uses

func (m *Schema_Atom) Reset()

func (*Schema_Atom) String Uses

func (m *Schema_Atom) String() string

func (*Schema_Atom) XXX_DiscardUnknown Uses

func (m *Schema_Atom) XXX_DiscardUnknown()

func (*Schema_Atom) XXX_Marshal Uses

func (m *Schema_Atom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Schema_Atom) XXX_Merge Uses

func (m *Schema_Atom) XXX_Merge(src proto.Message)

func (*Schema_Atom) XXX_Size Uses

func (m *Schema_Atom) XXX_Size() int

func (*Schema_Atom) XXX_Unmarshal Uses

func (m *Schema_Atom) XXX_Unmarshal(b []byte) error

type Schema_Bool Uses

type Schema_Bool struct {
    Bool *Schema_Atom `protobuf:"bytes,4,opt,name=bool,proto3,oneof"`
}

type Schema_Bytes Uses

type Schema_Bytes struct {
    Bytes *Schema_Sequence `protobuf:"bytes,6,opt,name=bytes,proto3,oneof"`
}

type Schema_Enum Uses

type Schema_Enum struct {
    Enum *Schema_Set `protobuf:"bytes,7,opt,name=enum,proto3,oneof"`
}

type Schema_Float Uses

type Schema_Float struct {
    Float *Schema_Atom `protobuf:"bytes,3,opt,name=float,proto3,oneof"`
}

type Schema_Int Uses

type Schema_Int struct {
    Int *Schema_Atom `protobuf:"bytes,1,opt,name=int,proto3,oneof"`
}

type Schema_JSON Uses

type Schema_JSON struct {
    // restricts the maximum amount of bytes that a Value for this field may
    // take.
    MaxLength            uint32   `protobuf:"varint,1,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*Schema_JSON) Descriptor Uses

func (*Schema_JSON) Descriptor() ([]byte, []int)

func (*Schema_JSON) GetMaxLength Uses

func (m *Schema_JSON) GetMaxLength() uint32

func (*Schema_JSON) ProtoMessage Uses

func (*Schema_JSON) ProtoMessage()

func (*Schema_JSON) Reset Uses

func (m *Schema_JSON) Reset()

func (*Schema_JSON) String Uses

func (m *Schema_JSON) String() string

func (*Schema_JSON) XXX_DiscardUnknown Uses

func (m *Schema_JSON) XXX_DiscardUnknown()

func (*Schema_JSON) XXX_Marshal Uses

func (m *Schema_JSON) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Schema_JSON) XXX_Merge Uses

func (m *Schema_JSON) XXX_Merge(src proto.Message)

func (*Schema_JSON) XXX_Size Uses

func (m *Schema_JSON) XXX_Size() int

func (*Schema_JSON) XXX_Unmarshal Uses

func (m *Schema_JSON) XXX_Unmarshal(b []byte) error

type Schema_Object Uses

type Schema_Object struct {
    Object *Schema_JSON `protobuf:"bytes,8,opt,name=object,proto3,oneof"`
}

type Schema_Sequence Uses

type Schema_Sequence struct {
    // restricts the maximum amount of bytes that a Value for this field may
    // take.
    MaxLength            uint32   `protobuf:"varint,1,opt,name=max_length,json=maxLength,proto3" json:"max_length,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*Schema_Sequence) Descriptor Uses

func (*Schema_Sequence) Descriptor() ([]byte, []int)

func (*Schema_Sequence) GetMaxLength Uses

func (m *Schema_Sequence) GetMaxLength() uint32

func (*Schema_Sequence) ProtoMessage Uses

func (*Schema_Sequence) ProtoMessage()

func (*Schema_Sequence) Reset Uses

func (m *Schema_Sequence) Reset()

func (*Schema_Sequence) String Uses

func (m *Schema_Sequence) String() string

func (*Schema_Sequence) XXX_DiscardUnknown Uses

func (m *Schema_Sequence) XXX_DiscardUnknown()

func (*Schema_Sequence) XXX_Marshal Uses

func (m *Schema_Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Schema_Sequence) XXX_Merge Uses

func (m *Schema_Sequence) XXX_Merge(src proto.Message)

func (*Schema_Sequence) XXX_Size Uses

func (m *Schema_Sequence) XXX_Size() int

func (*Schema_Sequence) XXX_Unmarshal Uses

func (m *Schema_Sequence) XXX_Unmarshal(b []byte) error

type Schema_Set Uses

type Schema_Set struct {
    // entry lists the possible tokens that this set can have.
    Entry                []*Schema_Set_Entry `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"`
    XXX_NoUnkeyedLiteral struct{}            `json:"-"`
    XXX_unrecognized     []byte              `json:"-"`
    XXX_sizecache        int32               `json:"-"`
}

func (*Schema_Set) Descriptor Uses

func (*Schema_Set) Descriptor() ([]byte, []int)

func (*Schema_Set) GetEntry Uses

func (m *Schema_Set) GetEntry() []*Schema_Set_Entry

func (*Schema_Set) Has Uses

func (s *Schema_Set) Has(token string) bool

Has returns true iff the given token is a valid value for this enumeration.

func (*Schema_Set) Normalize Uses

func (s *Schema_Set) Normalize() error

Normalize will normalize the Schema_Set, returning an error if it is invalid.

func (*Schema_Set) ProtoMessage Uses

func (*Schema_Set) ProtoMessage()

func (*Schema_Set) Reset Uses

func (m *Schema_Set) Reset()

func (*Schema_Set) String Uses

func (m *Schema_Set) String() string

func (*Schema_Set) XXX_DiscardUnknown Uses

func (m *Schema_Set) XXX_DiscardUnknown()

func (*Schema_Set) XXX_Marshal Uses

func (m *Schema_Set) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Schema_Set) XXX_Merge Uses

func (m *Schema_Set) XXX_Merge(src proto.Message)

func (*Schema_Set) XXX_Size Uses

func (m *Schema_Set) XXX_Size() int

func (*Schema_Set) XXX_Unmarshal Uses

func (m *Schema_Set) XXX_Unmarshal(b []byte) error

type Schema_Set_Entry Uses

type Schema_Set_Entry struct {
    // Markdown-formatted documentation for this schema entry.
    Doc                  string   `protobuf:"bytes,1,opt,name=doc,proto3" json:"doc,omitempty"`
    Token                string   `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

func (*Schema_Set_Entry) Descriptor Uses

func (*Schema_Set_Entry) Descriptor() ([]byte, []int)

func (*Schema_Set_Entry) GetDoc Uses

func (m *Schema_Set_Entry) GetDoc() string

func (*Schema_Set_Entry) GetToken Uses

func (m *Schema_Set_Entry) GetToken() string

func (*Schema_Set_Entry) ProtoMessage Uses

func (*Schema_Set_Entry) ProtoMessage()

func (*Schema_Set_Entry) Reset Uses

func (m *Schema_Set_Entry) Reset()

func (*Schema_Set_Entry) String Uses

func (m *Schema_Set_Entry) String() string

func (*Schema_Set_Entry) XXX_DiscardUnknown Uses

func (m *Schema_Set_Entry) XXX_DiscardUnknown()

func (*Schema_Set_Entry) XXX_Marshal Uses

func (m *Schema_Set_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Schema_Set_Entry) XXX_Merge Uses

func (m *Schema_Set_Entry) XXX_Merge(src proto.Message)

func (*Schema_Set_Entry) XXX_Size Uses

func (m *Schema_Set_Entry) XXX_Size() int

func (*Schema_Set_Entry) XXX_Unmarshal Uses

func (m *Schema_Set_Entry) XXX_Unmarshal(b []byte) error

type Schema_Str Uses

type Schema_Str struct {
    Str *Schema_Sequence `protobuf:"bytes,5,opt,name=str,proto3,oneof"`
}

type Schema_Uint Uses

type Schema_Uint struct {
    Uint *Schema_Atom `protobuf:"bytes,2,opt,name=uint,proto3,oneof"`
}

type Specifier Uses

type Specifier struct {
    TemplateName         string            `protobuf:"bytes,1,opt,name=template_name,json=templateName,proto3" json:"template_name,omitempty"`
    Params               map[string]*Value `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    XXX_NoUnkeyedLiteral struct{}          `json:"-"`
    XXX_unrecognized     []byte            `json:"-"`
    XXX_sizecache        int32             `json:"-"`
}

func (*Specifier) Descriptor Uses

func (*Specifier) Descriptor() ([]byte, []int)

func (*Specifier) GetParams Uses

func (m *Specifier) GetParams() map[string]*Value

func (*Specifier) GetTemplateName Uses

func (m *Specifier) GetTemplateName() string

func (*Specifier) Normalize Uses

func (s *Specifier) Normalize() error

Normalize will normalize this Specifier

func (*Specifier) ProtoMessage Uses

func (*Specifier) ProtoMessage()

func (*Specifier) Reset Uses

func (m *Specifier) Reset()

func (*Specifier) String Uses

func (m *Specifier) String() string

func (*Specifier) XXX_DiscardUnknown Uses

func (m *Specifier) XXX_DiscardUnknown()

func (*Specifier) XXX_Marshal Uses

func (m *Specifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Specifier) XXX_Merge Uses

func (m *Specifier) XXX_Merge(src proto.Message)

func (*Specifier) XXX_Size Uses

func (m *Specifier) XXX_Size() int

func (*Specifier) XXX_Unmarshal Uses

func (m *Specifier) XXX_Unmarshal(b []byte) error

type Value Uses

type Value struct {
    // Types that are valid to be assigned to Value:
    //	*Value_Int
    //	*Value_Uint
    //	*Value_Float
    //	*Value_Bool
    //	*Value_Str
    //	*Value_Bytes
    //	*Value_Object
    //	*Value_Array
    //	*Value_Null
    Value                isValue_Value `protobuf_oneof:"value"`
    XXX_NoUnkeyedLiteral struct{}      `json:"-"`
    XXX_unrecognized     []byte        `json:"-"`
    XXX_sizecache        int32         `json:"-"`
}

Value defines a specific value for a parameter, and is used at Template expansion time.

func MustNewValue Uses

func MustNewValue(v interface{}) *Value

MustNewValue creates a new *Value wrapping v, and panics if v is a bad type

func NewValue Uses

func NewValue(v interface{}) (*Value, error)

NewValue creates a new *Value wrapping v.

Allowed types are:

* Any of the explicit *Value_Int - style types
* nil -> Null
* string -> String
* []byte -> Bytes
* int, int8, int16, int32, int64 -> Integer
* uint, uint8, uint16, uint32, uint64 -> Unsigned
* float32, float64 -> Float
* bool -> Boolean
* map[string]interface{} -> Object
* []interface{} -> Array

func (*Value) Check Uses

func (v *Value) Check(s *Schema) error

Check ensures that this value conforms to the given schema.

func (*Value) Descriptor Uses

func (*Value) Descriptor() ([]byte, []int)

func (*Value) GetArray Uses

func (m *Value) GetArray() string

func (*Value) GetBool Uses

func (m *Value) GetBool() bool

func (*Value) GetBytes Uses

func (m *Value) GetBytes() []byte

func (*Value) GetFloat Uses

func (m *Value) GetFloat() float64

func (*Value) GetInt Uses

func (m *Value) GetInt() int64

func (*Value) GetNull Uses

func (m *Value) GetNull() *empty.Empty

func (*Value) GetObject Uses

func (m *Value) GetObject() string

func (*Value) GetStr Uses

func (m *Value) GetStr() string

func (*Value) GetUint Uses

func (m *Value) GetUint() uint64

func (*Value) GetValue Uses

func (m *Value) GetValue() isValue_Value

func (*Value) IsNull Uses

func (v *Value) IsNull() bool

IsNull returns true if this Value is the null value.

func (*Value) JSONRender Uses

func (v *Value) JSONRender() string

JSONRender returns the to-be-injected string rendering of v.

func (*Value) Normalize Uses

func (v *Value) Normalize() error

Normalize returns a non-nil error if the Value is invalid for its nominal type.

func (*Value) ProtoMessage Uses

func (*Value) ProtoMessage()

func (*Value) Reset Uses

func (m *Value) Reset()

func (*Value) String Uses

func (m *Value) String() string

func (*Value) XXX_DiscardUnknown Uses

func (m *Value) XXX_DiscardUnknown()

func (*Value) XXX_Marshal Uses

func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Value) XXX_Merge Uses

func (m *Value) XXX_Merge(src proto.Message)

func (*Value) XXX_OneofFuncs Uses

func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*Value) XXX_Size Uses

func (m *Value) XXX_Size() int

func (*Value) XXX_Unmarshal Uses

func (m *Value) XXX_Unmarshal(b []byte) error

type Value_Array Uses

type Value_Array struct {
    Array string `protobuf:"bytes,8,opt,name=array,proto3,oneof"`
}

func (*Value_Array) Check Uses

func (v *Value_Array) Check(schema *Schema) error

Check returns nil iff this Value correctly parses as a JSON array.

func (*Value_Array) JSONRender Uses

func (v *Value_Array) JSONRender() string

JSONRender returns a rendering of this JSON array as JSON. This is a direct return of the JSON encoded string; no validation is done. To check that the contained string is valid, use the Valid() method.

func (*Value_Array) Normalize Uses

func (v *Value_Array) Normalize() error

Normalize returns nil iff this Value correctly parses as a JSON array.

type Value_Bool Uses

type Value_Bool struct {
    Bool bool `protobuf:"varint,4,opt,name=bool,proto3,oneof"`
}

func (*Value_Bool) JSONRender Uses

func (v *Value_Bool) JSONRender() string

JSONRender returns a rendering of this bool as JSON, e.g. go value true renders as `true`.

type Value_Bytes Uses

type Value_Bytes struct {
    Bytes []byte `protobuf:"bytes,6,opt,name=bytes,proto3,oneof"`
}

func (*Value_Bytes) Check Uses

func (v *Value_Bytes) Check(schema *Schema) error

Check returns nil iff this Value meets the max length criteria.

func (*Value_Bytes) JSONRender Uses

func (v *Value_Bytes) JSONRender() string

JSONRender returns a rendering of these bytes as JSON, e.g. go value []byte("foo") renders as `"Zm9v"`.

type Value_Float Uses

type Value_Float struct {
    Float float64 `protobuf:"fixed64,3,opt,name=float,proto3,oneof"`
}

func (*Value_Float) JSONRender Uses

func (v *Value_Float) JSONRender() string

JSONRender returns a rendering of this float as JSON, e.g. go value 1.23 renders as `1.23`.

type Value_Int Uses

type Value_Int struct {
    Int int64 `protobuf:"varint,1,opt,name=int,proto3,oneof"`
}

func (*Value_Int) JSONRender Uses

func (v *Value_Int) JSONRender() string

JSONRender returns a rendering of this int as JSON, e.g. go value 100 renders as `100`. If the absolute value is > 2**53, this will render it as a string.

Integers render as strings to avoid encoding issues in JSON, which only supports double-precision floating point numbers.

type Value_Null Uses

type Value_Null struct {
    Null *empty.Empty `protobuf:"bytes,9,opt,name=null,proto3,oneof"`
}

func (*Value_Null) JSONRender Uses

func (v *Value_Null) JSONRender() string

JSONRender returns a rendering of null. This always returns `null`.

type Value_Object Uses

type Value_Object struct {
    Object string `protobuf:"bytes,7,opt,name=object,proto3,oneof"`
}

func (*Value_Object) Check Uses

func (v *Value_Object) Check(schema *Schema) error

Check returns nil iff this Value correctly parses as a JSON object.

func (*Value_Object) JSONRender Uses

func (v *Value_Object) JSONRender() string

JSONRender returns a rendering of this JSON object as JSON. This is a direct return of the JSON encoded string; no validation is done. To check that the contained string is valid, use the Valid() method.

func (*Value_Object) Normalize Uses

func (v *Value_Object) Normalize() error

Normalize returns nil iff this Value correctly parses as a JSON object.

type Value_Str Uses

type Value_Str struct {
    Str string `protobuf:"bytes,5,opt,name=str,proto3,oneof"`
}

func (*Value_Str) Check Uses

func (v *Value_Str) Check(schema *Schema) error

Check returns nil iff this Value meets the max length criteria, and/or can be used to fill an enumeration value from the provided schema.

func (*Value_Str) JSONRender Uses

func (v *Value_Str) JSONRender() string

JSONRender returns a rendering of this string as JSON, e.g. go value "foo" renders as `"foo"`.

type Value_Uint Uses

type Value_Uint struct {
    Uint uint64 `protobuf:"varint,2,opt,name=uint,proto3,oneof"`
}

func (*Value_Uint) JSONRender Uses

func (v *Value_Uint) JSONRender() string

JSONRender returns a rendering of this uint as JSON, e.g. go value 100 renders as `"100"`.

Unsigns render as strings to avoid encoding issues in JSON, which only supports double-precision floating point numbers.

Package templateproto imports 15 packages (graph) and is imported by 4 packages. Updated 2018-10-23. Refresh now. Tools for package owners.