generate

package
v0.24.6 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Camelize = inflect.Camelize
View Source
var Pascal = inflect.Pascal
View Source
var Titlecase = inflect.Titlecase

Functions

func Includes

func Includes(strs []string, str string) (ret bool)

does the passed string list include the passed string?

Types

type DB

type DB interface {
	Write(q string, args ...interface{}) error
}

database/sql like interface

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

the generator walks a list of groups, producing one group at a time: each of which can be written to its own location.

func MakeGenerator

func MakeGenerator(groups []Group) (ret Generator, err error)

func (*Generator) Name

func (q *Generator) Name() string

func (*Generator) Next

func (q *Generator) Next() (okay bool)

advance before writing

func (*Generator) WriteReferences

func (q *Generator) WriteReferences(w DB) error

record the derived type data for the current group using sqlite friendly data to the passed database

func (Generator) WriteSchema added in v0.24.6

func (q Generator) WriteSchema(w io.Writer) (err error)

func (*Generator) WriteSource

func (q *Generator) WriteSource(w io.Writer) error

write a go file containing typeinfo for the current group

func (*Generator) WriteTable

func (q *Generator) WriteTable(w DB) error

record the primary type data for the current group using sqlite friendly data to the passed database

type Group

type Group struct {
	Name string

	Comment []string
	// contains filtered or unexported fields
}

func ReadSpec

func ReadSpec(msg compact.Message) (ret Group, err error)

read a "Spec:requires:contains:" message

type Hashed

type Hashed struct {
	Value  uint64
	String string
}

func Hash

func Hash(slat, slot string) Hashed

Hash helper for generating signatures lookups the slat includes all of the colon separated labels used to indicate a given type. the slot specifes the typename the slat fits into.

type MessageMap

type MessageMap map[string]any

func MakeMessageMap added in v0.24.6

func MakeMessageMap(msg compact.Message) MessageMap

turn slices of labels and args into a map of { label => arg }

func (MessageMap) GetBool

func (mm MessageMap) GetBool(name string) (ret bool, err error)

returns false if there was a value, but it wasnt a bool

func (MessageMap) GetMessages added in v0.24.6

func (mm MessageMap) GetMessages(key string) (ret []compact.Message, err error)

expects that v is nil, or a slice of messages.

func (MessageMap) GetString

func (mm MessageMap) GetString(key, otherwise string) (ret string, err error)

returns false if there was a value, but it wasnt a string

func (MessageMap) GetStrings added in v0.24.6

func (mm MessageMap) GetStrings(key string) (ret []string, err error)

expects that v is nil, a string, or a slice of strings

type Names

type Names []string

func (*Names) AddName

func (gs *Names) AddName(g string)

type Registry

type Registry []Signature

Accumulates tapestry type specs to build lists of slots and slats and their signatures. Doesnt currently support multiple groups

func (Registry) Sort

func (reg Registry) Sort()

type Signature

type Signature struct {
	Type     string // ex. DiffOf
	Slot     string // ex. number_eval
	Sig      string // ex. "number_eval=Dec:by: "
	Hash     uint64 // ex. 10788210406716082593
	Optional bool
}

func (*Signature) Body

func (a *Signature) Body() (ret string)

the right side of the equal sign

func (*Signature) IsLessThan

func (a *Signature) IsLessThan(b Signature) (okay bool)
type TypeLink string
func (t TypeLink) Link() (ret string, err error)

func (TypeLink) Type added in v0.24.6

func (t TypeLink) Type() string

Jump to

Keyboard shortcuts

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