Documentation
¶
Overview ¶
Package schema reads a .zap schema file.
The generator (zap-proto/go cmd/zapgen) has a parser, but it lives in a main package and cannot be imported, so a schema shipped next to a codec is prose that nothing checks. This reader closes that: a test can load the .zap and hold the shipped codec to it.
Grammar, as zapgen defines it:
file := 'package' ident (alias | struct | interface)*
alias := 'type' ident '=' type
struct := 'struct' ident '{' field* '}'
field := ident type '@' int
type := 'list' '<' type '>' | 'bytes_fixed' '[' int ']'
| bool | u8 | u16 | u32 | u64 | i8 | i16 | i32 | i64
| f32 | f64 | bytes | text | ident
'#' runs to end of line. Interfaces are skipped: they declare calls, and this reader is about layout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Name string
Kind Kind
Fixed int // bytes_fixed[N]
Elem Kind // list<T>
Off int
}
Field is one declared field.
Click to show internal directories.
Click to hide internal directories.