Documentation
¶
Overview ¶
Package schema reads a wire schema: a Go package of plain types marked with //wire: directives. It is what the generators in wire/gen consume.
//wire:message on a struct: a top-level message (gets an id)
//wire:union on an interface with one unexported method:
a value that is one of several structs
//wire:variant <Union> on a struct: one of the union's variants
//wire:enum on a named integer type: its constants are the values
Every other exported struct in the package is a plain nested type. The schema package must stand alone (no imports) so it can be type-checked without a build.
Index ¶
Constants ¶
View Source
const MessageUnion = "Message"
MessageUnion is the name of the generated union over every message.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Schema ¶
type Schema struct {
Package string // Go package name, e.g. "proto"
Dir string
Structs []*StructDef
Unions []*UnionDef
Enums []*EnumDef
Messages []string // message struct names; a message's id is its index + 1
Hash uint64 // FNV-1a of Canonical()
}
Schema is one package's wire types.
Click to show internal directories.
Click to hide internal directories.