Documentation
¶
Overview ¶
Copyright (C) 2014 Pivotal Software, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (C) 2014 Pivotal Software, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (C) 2014 Pivotal Software, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (C) 2014 Pivotal Software, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (C) 2014 Pivotal Software, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the "License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func Camelcase(input string) string
- func Concat(first string, second string) string
- func CoreDataTypes() map[string]string
- func HasListType(model Model) bool
- func IdProp(properties []ModelProperty) string
- func IsCustomType(customType string, prop ModelProperty) bool
- func IsJavaType(prop ModelProperty) bool
- func IsSqliteType(prop ModelProperty) bool
- func JavaTypes() map[string]string
- func Lower(input string) string
- func PackageToPath(input string) string
- func Pluralize(input string) string
- func Prefix(prefix string, original string) string
- func RailsTypes() map[string]string
- func RegisterCustomType(customType string) string
- func SHA256(data string) string
- func SetCustomType(customType string, key string, value string) string
- func Snakecase(input string) string
- func SqliteTypes() map[string]string
- func Suffix(suffix string, original string) string
- func TestEquality(args ...interface{}) bool
- func TestInequality(args ...interface{}) bool
- func Titlecase(input string) string
- func ToCoreDataType(input string) string
- func ToCustomType(customType string, prop ModelProperty) string
- func ToJavaType(prop ModelProperty) string
- func ToRailsType(prop ModelProperty) string
- func ToSqliteType(prop ModelProperty) string
- func Truncate(targetLength int, tooLong string) string
- func Upper(input string) string
- type ConfigurationAdapter
- type Context
- func (context *Context) AddModel(model Model) (*Model, error)
- func (context *Context) AddModelWithName(name string) (*Model, error)
- func (context *Context) AddTemplate(fileName string, body []byte, version string, directory string, ...) (*TemplateInfo, error)
- func (context *Context) AddTemplateDirectory(templateDirPath string) ([]TemplateInfo, error)
- func (context *Context) AddTemplateFeature(feature string)
- func (context *Context) AddTemplateFile(path string, info os.FileInfo, err error) error
- func (context *Context) AddTemplateFilePath(filePath string) (TemplateInfo, error)
- func (context *Context) AddTemplatesForModelsMapping(templateFileNames []string, modelNames []string) error
- func (context *Context) FindTemplate(fileName string, directory string) (*TemplateInfo, error)
- func (context *Context) ModelForName(name string) (*Model, error)
- func (context *Context) RemoveTemplateFeature(feature string)
- func (context *Context) TemplateForFileName(fileName string) ([]*TemplateInfo, error)
- type GeneratedFile
- type GoTemplateAdapter
- func (self *GoTemplateAdapter) GenerateFiles(templateInfo TemplateInfo, templateData TemplateData) ([]GeneratedFile, error)
- func (self *GoTemplateAdapter) GetFilesFromOutput(buffer *bytes.Buffer, directory string) ([]GeneratedFile, error)
- func (self *GoTemplateAdapter) ParseTemplate(templateInfo TemplateInfo) error
- type JSONSchemaAdapter
- type Model
- type ModelProperty
- type OutputAdapter
- type Schema
- type SchemaAdapter
- type TemplateData
- type TemplateInfo
- type TemplatesForModels
Constants ¶
const LibraryVersion string = "1.0.0"
Variables ¶
var CustomType map[string]map[string]string
Functions ¶
func CoreDataTypes ¶
func HasListType ¶
func IdProp ¶
func IdProp(properties []ModelProperty) string
func IsCustomType ¶
func IsCustomType(customType string, prop ModelProperty) bool
func IsJavaType ¶
func IsJavaType(prop ModelProperty) bool
func IsSqliteType ¶
func IsSqliteType(prop ModelProperty) bool
func PackageToPath ¶
func RailsTypes ¶
func RegisterCustomType ¶
func SqliteTypes ¶
func TestEquality ¶
func TestEquality(args ...interface{}) bool
func TestInequality ¶
func TestInequality(args ...interface{}) bool
func ToCoreDataType ¶
func ToCustomType ¶
func ToCustomType(customType string, prop ModelProperty) string
func ToJavaType ¶
func ToJavaType(prop ModelProperty) string
func ToRailsType ¶
func ToRailsType(prop ModelProperty) string
func ToSqliteType ¶
func ToSqliteType(prop ModelProperty) string
Types ¶
type ConfigurationAdapter ¶
type Context ¶
type Context struct { ProjectName string PackageName string TemplaterVersion string Schema Schema Templates []TemplateInfo Mappings []TemplatesForModels Language string TemplateFeatures map[string]bool GoAdapter GoTemplateAdapter }
func BeginContext ¶
func BeginContext() Context
func (*Context) AddModelWithName ¶
func (*Context) AddTemplate ¶
func (context *Context) AddTemplate(fileName string, body []byte, version string, directory string, adapter OutputAdapter) (*TemplateInfo, error)
func (*Context) AddTemplateDirectory ¶
func (context *Context) AddTemplateDirectory(templateDirPath string) ([]TemplateInfo, error)
func (*Context) AddTemplateFeature ¶
func (*Context) AddTemplateFile ¶
func (*Context) AddTemplateFilePath ¶
func (context *Context) AddTemplateFilePath(filePath string) (TemplateInfo, error)
func (*Context) AddTemplatesForModelsMapping ¶
func (*Context) FindTemplate ¶
func (context *Context) FindTemplate(fileName string, directory string) (*TemplateInfo, error)
func (*Context) RemoveTemplateFeature ¶
func (*Context) TemplateForFileName ¶
func (context *Context) TemplateForFileName(fileName string) ([]*TemplateInfo, error)
type GeneratedFile ¶
func ProcessMappings ¶
func ProcessMappings(context Context) ([]GeneratedFile, error)
type GoTemplateAdapter ¶
func (*GoTemplateAdapter) GenerateFiles ¶
func (self *GoTemplateAdapter) GenerateFiles(templateInfo TemplateInfo, templateData TemplateData) ([]GeneratedFile, error)
func (*GoTemplateAdapter) GetFilesFromOutput ¶
func (self *GoTemplateAdapter) GetFilesFromOutput(buffer *bytes.Buffer, directory string) ([]GeneratedFile, error)
func (*GoTemplateAdapter) ParseTemplate ¶
func (self *GoTemplateAdapter) ParseTemplate(templateInfo TemplateInfo) error
type JSONSchemaAdapter ¶
type JSONSchemaAdapter struct{}
func GetJSONSchemaAdapter ¶
func GetJSONSchemaAdapter() JSONSchemaAdapter
func (*JSONSchemaAdapter) ParseModelSchemaString ¶
func (self *JSONSchemaAdapter) ParseModelSchemaString(schemaString []byte) (Schema, error)
func (*JSONSchemaAdapter) ProcessSchemaFile ¶
func (self *JSONSchemaAdapter) ProcessSchemaFile(schemaPath string) (Schema, error)
type Model ¶
type Model struct { Name string Parent string ParentRef *Model Properties []ModelProperty }
func (*Model) AddProperty ¶
type ModelProperty ¶
type OutputAdapter ¶
type OutputAdapter interface { ParseTemplate(template TemplateInfo) error GenerateFiles(templateInfo TemplateInfo, templateData TemplateData) ([]GeneratedFile, error) GetFilesFromOutput(buffer *bytes.Buffer, directory string) ([]GeneratedFile, error) }
type SchemaAdapter ¶
type TemplateData ¶
type TemplateInfo ¶
type TemplatesForModels ¶
type TemplatesForModels struct { Models []*Model Templates []*TemplateInfo }