mddmb

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

README

MDDeclarative Model Builder

👁 Go Reference Go Report Card

import "git.fractalqb.de/fractalqb/mddmb" 

This allows you to create [qb]MDD models with a more declarative Go syntax than with the MDD core API or the MDD Model Builder API.

Documentation

Index

Constants

View Source
const (
	Entity classFlag = iota
	Abstract
)
View Source
const (
	NotComparable = Comparability(mdd.NotComparable)
	Comparable    = Comparability(mdd.Comparable)
	Ordered       = Comparability(mdd.Ordered)
)
View Source
const (
	One multFlag = iota
	Opt
)
View Source
const Derived attributeFlag = 0
View Source
const Extensible boolExt = true

Variables

This section is empty.

Functions

func Association

func Association(a *assocDefn, defn ...any) *assocDefn

func Attribute

func Attribute(name string, defn ...AttributeCmd) attrib

func Between

func Between(defn ...any) between

func Build

func Build(m *mdd.Model, defn ...ModelCmd) error

func BuildAtom

func BuildAtom(a *mdd.Atom, defn ...AtomCmd) error

func BuildClass

func BuildClass(c *mdd.Class, defn ...ClassCmd) error

func BuildEnum

func BuildEnum(e *mdd.Enum, defn ...EnumCmd) error

func BuildPackage

func BuildPackage(pkg *mdd.Package, defn ...PackageCmd) error

func From

func From(defn ...any) from

func Key

func Key(defn ...any) key

func MixIn

func MixIn(mode mdd.MixMode, classes ...*ClassVar) mix

func Model

func Model(name string, defn ...ModelCmd) (*mdd.Model, error)

func Restict

func Restict(atoms ...*AtomVar) restrict

func Tag

func Tag(key, value any) tag

Types

type AtomCmd

type AtomCmd interface{ Atom(*mdd.Atom) error }

type AtomDefn added in v0.1.1

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

func Atom

func Atom(name string, defn ...AtomCmd) AtomDefn

TODO Comparability -> atomDefn

func (AtomDefn) GetFrom added in v0.1.1

func (def AtomDefn) GetFrom(p *mdd.Package) *mdd.Atom

func (AtomDefn) Package added in v0.1.1

func (def AtomDefn) Package(in *mdd.Package) error

func (AtomDefn) Store added in v0.1.1

func (a AtomDefn) Store(in *AtomVar) AtomDefn

type AtomVar

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

func (*AtomVar) Attribute

func (t *AtomVar) Attribute(*mdd.Attribute) error

func (AtomVar) SetLang

func (v AtomVar) SetLang(lang string, mapped any) error

func (*AtomVar) Type added in v0.1.1

func (t *AtomVar) Type() T

type AttributeCmd

type AttributeCmd interface{ Attribute(*mdd.Attribute) error }

type ClassCmd

type ClassCmd interface{ Class(*mdd.Class) error }

type ClassDefn

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

func Class

func Class(name string, defn ...ClassCmd) ClassDefn

func (ClassDefn) GetFrom added in v0.1.1

func (def ClassDefn) GetFrom(p *mdd.Package) *mdd.Class

func (ClassDefn) Package

func (def ClassDefn) Package(in *mdd.Package) error

func (ClassDefn) Store

func (c ClassDefn) Store(in *typeVar[*mdd.Class]) ClassDefn

type ClassVar

type ClassVar = typeVar[*mdd.Class]

type CommonTypes

type CommonTypes struct {
	// Use this to represent Boolean values
	Bool AtomVar

	// The integer numbers ℤ
	Integer AtomVar

	// Natural numbers including zero ℕ∪{0}
	NonNegInt AtomVar

	// Natural numbers ℕ (according to Peano's original formulation i.e. 0∉ℕ)
	PositiveInt AtomVar

	// Real numbers ℝ (somewhat hard to completely map to implementations)
	Real AtomVar

	// The subset of ℝ that can be exactly represented as a decimal numeral
	Decimal AtomVar

	// Sequence of symbols (most often implemented by a notion of computer
	// string)
	Text AtomVar

	// Denotes a specific day on earth. Its up to you if you consider it to be
	// with or without time-zone.
	Date AtomVar

	// Wall-clock time, independent of any date. Its up to you if you consider
	// it to be with or without time-zone.
	Time AtomVar

	// A precise instant in time.  Its up to you if you consider it to be with
	// or without time-zone.
	Timestamp AtomVar
}

func (*CommonTypes) Package

func (lib *CommonTypes) Package(p *mdd.Package) error

type Comparability

type Comparability mdd.Comparability

func (Comparability) Atom

func (c Comparability) Atom(a *mdd.Atom) error

func (Comparability) Enum

func (c Comparability) Enum(e *mdd.Enum) error

func (Comparability) String

func (i Comparability) String() string

type EnumCmd

type EnumCmd interface{ Enum(*mdd.Enum) error }

type EnumDefn added in v0.1.1

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

func Enum

func Enum(name string, defn ...EnumCmd) EnumDefn

func (EnumDefn) GetFrom added in v0.1.1

func (def EnumDefn) GetFrom(p *mdd.Package) *mdd.Enum

func (EnumDefn) Package added in v0.1.1

func (def EnumDefn) Package(in *mdd.Package) error

func (EnumDefn) Store added in v0.1.1

func (e EnumDefn) Store(in *typeVar[*mdd.Enum]) EnumDefn

type EnumVar

type EnumVar = typeVar[*mdd.Enum]

type Extends

type Extends []*ClassVar

func (Extends) Class

func (Extends) Class(*mdd.Class) error

type Literals

type Literals []string

func (Literals) Enum

func (Literals) Enum(*mdd.Enum) error

type Many

type Many uint

func (Many) Attribute

func (Many) Attribute(*mdd.Attribute) error

type ModelCmd

type ModelCmd interface{ Model(*mdd.Model) error }

type Mult

type Mult struct{ Min, Max uint }

func (Mult) Attribute

func (Mult) Attribute(*mdd.Attribute) error

type Num

type Num uint

func (Num) Attribute

func (Num) Attribute(*mdd.Attribute) error

type PackageCmd

type PackageCmd interface{ Package(*mdd.Package) error }

type PackageDefn

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

func Package

func Package(name string, defn ...PackageCmd) PackageDefn

func (PackageDefn) GetFrom added in v0.1.1

func (p PackageDefn) GetFrom(m *mdd.Model) *mdd.Package

func (PackageDefn) Model

func (def PackageDefn) Model(in *mdd.Model) error

func (PackageDefn) Store

func (p PackageDefn) Store(in **mdd.Package) PackageDefn

Directories

Path Synopsis
examples
mymusic/puml
Generate PlantUML class diagram for example model.
Generate PlantUML class diagram for example model.
mymusic/template
Generate AsciiDoc output with Go's text/template from example model.
Generate AsciiDoc output with Go's text/template from example model.

Jump to

Keyboard shortcuts

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