core

package
v0.0.0-...-e95732d Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UIPort  = 4000
	GQLPort = 8080
	RPCPort = 5050
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Name        string        `yaml:"name"`
	Description string        `yaml:"description"`
	PortMap     *PortMap      `yaml:"-"`
	Author      string        `yaml:"author"`
	Version     int           `yaml:"version"`
	Language    Lang          `yaml:"language"`
	Date        string        `yaml:"date"`
	Deps        []*Dependency `yaml:"deps"`
	Models      []*Model      `yaml:"types"`
	Funcs       []*Func       `yaml:"funcs"`
}

func NewAPI

func NewAPI(name, author, date string, lang Lang) *API

func (*API) AddDep

func (a *API) AddDep(d *Dependency)

func (*API) AddFunc

func (a *API) AddFunc(f *Func)

func (*API) AddModel

func (a *API) AddModel(t *Model)

func (*API) HasSubs

func (a *API) HasSubs() bool

type BaseType

type BaseType string
const (
	Int    BaseType = "int"
	Float  BaseType = "float"
	String BaseType = "string"
	ID     BaseType = "ID"
	Bool   BaseType = "bool"
)

func (BaseType) IsPrimitive

func (t BaseType) IsPrimitive() bool

func (BaseType) String

func (t BaseType) String() string

type Checker

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

func NewChecker

func NewChecker() *Checker

func (*Checker) PostOrder

func (c *Checker) PostOrder(name string) (int, bool)

func (*Checker) VisitModule

func (c *Checker) VisitModule(m *Module) error

type Dependency

type Dependency struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

type Field

type Field struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Type        Type   `yaml:"type"`
	Required    bool   `yaml:"required,omitempty"`
	Last        bool   `yaml:"-"`
	IsArray     bool   `yaml:"IsArray,omitempty"`
	Query       bool   `yaml:"query,omitempty"`
	Create      bool   `yaml:"create,omitempty"`
	Update      bool   `yaml:"update,omitempty"`
	Delete      bool   `yaml:"delete,omitempty"`
	Subscribe   bool   `yaml:"subscribe,omitempty"`
	IsExternal  bool   `yaml:"is_external,omitempty"`
}

Field represents a field on a model

func External

func External(name, kind, pluralKind string) *Field

type Func

type Func struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	UserCode    string   `yaml:"user_code"`
	Return      []*Field `yaml:"return"`
	Params      []*Field `yaml:"params"`
}

type Lang

type Lang string
const (
	Go         Lang = "go"
	TypeScript Lang = "ts"
	Python     Lang = "py"
	Protobuf   Lang = "proto"
	SQL        Lang = "sql"
)

type MetaData

type MetaData struct {
	ID          string   `yaml:"id" json:"_id,omitempty"`
	Rev         string   `yaml:"rev" json:"_rev,omitempty"`
	Name        string   `yaml:"name" json:"name,omitempty"`
	Description string   `yaml:"description" json:"description,omitempty"`
	Author      string   `yaml:"author" json:"author,omitempty"`
	Date        string   `yaml:"date" json:"date,omitempty"`
	PortMap     *PortMap `yaml:"ports" json:"port_map,omitempty"`
}

type Model

type Model struct {
	IsExternal  bool
	Name        string
	Plural      string
	Description string
	Query       bool
	Create      bool
	Update      bool
	Delete      bool
	Fields      []*Field
}

func (*Model) IsPrimitive

func (m *Model) IsPrimitive() bool

func (*Model) String

func (m *Model) String() string

type Module

type Module struct {
	*MetaData
	Version int
	// contains filtered or unexported fields
}

func NewModule

func NewModule(name, author, date string) *Module

func (*Module) APIs

func (m *Module) APIs() []*API

func (*Module) AddAPI

func (m *Module) AddAPI(a *API)

func (*Module) Meta

func (m *Module) Meta() *MetaData

type PortMap

type PortMap struct {
	UI  int
	GQL int
	RPC int
}

func (*PortMap) Add

func (p *PortMap) Add(n int) *PortMap

type Storable

type Storable interface {
	Meta() *MetaData
}

type System

type System struct {
	*MetaData
	Modules []*Module `yaml:"modules" json:"modules,omitempty"`
}

func NewSystem

func NewSystem(name, description, author, date string) *System

func (*System) AddModule

func (s *System) AddModule(m *Module) error

func (*System) Description

func (s *System) Description() string

func (*System) FilterValue

func (s *System) FilterValue() string

func (*System) Meta

func (s *System) Meta() *MetaData

func (*System) Title

func (s *System) Title() string

type Type

type Type interface {
	IsPrimitive() bool
	String() string
}

type Visitor

type Visitor interface {
	VisitSystem(ctx context.Context, s *System) error
	VisitModule(ctx context.Context, m *Module) error
}

Jump to

Keyboard shortcuts

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