gen

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: BSD-3-Clause Imports: 5 Imported by: 0

README

gen

This library is used to generate the go-fed/activity/vocab library implementation. Changes to this will fundamentally change the implementation of the vocab library. If custom ActivityStream types are required, no changes to this are required. Instead, the go-fed/activity/tools/defs library will need edits.

Creating a static type implementation from the specification is not straightforward due to the following considerations that stem from its roots in JSON-LD:

  • Any property could be an IRI (url.URL)
  • Most properties could be another ActivityStream type (map[string]interface{}) or a value (time.Time, etc)
  • Most properties can have multiple values ([]interface{})
  • In a multiple value scenario, each value could once more be an IRI, another ActivityStream type, or a value

The current generation algorithm leaves ample opportunity for improvements and optimizations.

Documentation

Overview

Package gen contains the libraries and algorithms used to generate the code for the vocab package.

Index

Constants

View Source
const (
	ObjectTypeName = "ObjectType"
	LinkTypeName   = "LinkType"
)

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(r defs.RangeReference, mapName, field string, slice bool) string

func InterfaceName

func InterfaceName(t *defs.Type) string

func Name

func Name(r defs.RangeReference) string

func Serialize

func Serialize(r defs.RangeReference, mapName, field string, slice bool) string

func Type

func Type(r defs.RangeReference) string

Types

type File

type File struct {
	Name    string
	Content []byte
}

func GenerateImplementations

func GenerateImplementations(types []*defs.Type, properties []*defs.PropertyType, values []*defs.ValueType) (f []*File, err error)

Jump to

Keyboard shortcuts

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