Documentation
¶
Overview ¶
Package ptlbuilder provides utilities for building protocol specifications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyName = errors.New("name cannot be empty") ErrEmptyType = errors.New("type cannot be empty") ErrEmptyPackage = errors.New("package name cannot be empty") ErrZeroTimeout = errors.New("timeout must be greater than 0") )
Common errors
Functions ¶
This section is empty.
Types ¶
type Command ¶
Command represents a protocol command with its fields.
func NewCommand ¶
NewCommand creates a new command with validation. Only allow UpperCamel / Pascal Case
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator handles protocol code generation
func NewGenerator ¶
func NewGenerator(spec *ProtocolSpec) *Generator
NewGenerator creates a new protocol generator
type ProtocolSpec ¶
type ProtocolSpec struct { Package string Commands []*Command Timeout uint // maximum seconds allowed to decode message }
ProtocolSpec represents the complete protocol specification.
func NewProtocolSpec ¶
func NewProtocolSpec(pkg string, timeout uint) *ProtocolSpec
NewProtocolSpec creates a new protocol specification with validation.
func (*ProtocolSpec) AddCommand ¶
func (p *ProtocolSpec) AddCommand(cmd *Command) *ProtocolSpec
AddCommand adds a new command to the protocol specification.
func (*ProtocolSpec) Validate ¶
func (p *ProtocolSpec) Validate() error
Validate checks if the protocol specification is valid.
Click to show internal directories.
Click to hide internal directories.