models

package
v0.0.0-...-17fbf12 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2017 License: MIT Imports: 12 Imported by: 2

Documentation

Overview

Package models creates the models for the modules

Index

Constants

This section is empty.

Variables

View Source
var PackageTemplate = `// Package models holds generated struct for {{.Schema.Title}}.
package models
`

PackageTemplate holds the template for the packages of the models

View Source
var StructTemplate = `
{{AsComment .Schema.Description}}
type {{ToUpperFirst .Schema.Title}} {{goType .Schema}}
`

StructTemplate holds the template for the structs of the models

Functions

func GenerateModel

func GenerateModel(s *schema.Schema) ([]byte, error)

GenerateModel generates the model itself

func GeneratePackage

func GeneratePackage(s *schema.Schema) ([]byte, error)

GeneratePackage generates the imports according to the schema. TODO remove this function

func GenerateSchema

func GenerateSchema(s *schema.Schema) ([]byte, error)

GenerateSchema generates the schema.

Types

type Generator

type Generator struct{}

Generator for models

func (*Generator) Generate

func (g *Generator) Generate(req *common.Req, res *common.Res) error

Generate generates models for schema

Directories

Path Synopsis
Package constants generates the constant variables for a model/schema
Package constants generates the constant variables for a model/schema
Package constructors generates the constructors for given schema/model
Package constructors generates the constructors for given schema/model

Jump to

Keyboard shortcuts

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