models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 1 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Parent     Type         // The type that contains this field.
	Name       string       // The name of the field.
	Definition string       // The type definition of the field.
	Convert    string       // The convert-function used to copy the field.
	Fields     []*Field     // The fields of this field.
	Of         *Field       // The field that this field is a field of.
	From       *Field       // The field that this field will be copied from.
	To         *Field       // The field that this field will be copied to.
	Options    FieldOptions // The custom options of a field.
}

Field represents a field to be copied to/from.

func (Field) String

func (f Field) String() string

type FieldOptions

type FieldOptions struct {
	Deepcopy string                 // Whether the field should be deepcopied.
	Custom   map[string]interface{} // The custom options of a field.
}

FieldOptions represent options for a Field.

type Function

type Function struct {
	Name    string          // The name of the function.
	To      []Type          // The types to copy fields to.
	From    []Type          // The types to copy fields from.
	Options FunctionOptions // The custom options of a function.
}

Function represents the properties of a generated function.

type FunctionOptions

type FunctionOptions struct {
	Custom map[string]interface{} // The custom options of a function.
}

FunctionOptions represent options for a Function.

type Generator

type Generator struct {
	Filepath  string     // The generated filepath.
	Loadpath  string     // The loader filepath.
	Template  Template   // The template used to generate code.
	Package   string     // The generated package.
	Imports   []string   // The imports included in the generated file.
	Functions []Function // The functions to generate.
}

Generator represents a code generator.

type Template

type Template struct {
	Headpath string // The filepath to the template that generates header code.
	Funcpath string // The filepath to the template that generates function code.
}

Template represets the template used to generate code.

type Type

type Type struct {
	Package      string      // The package the type is defined in.
	Name         string      // The name of the type in the provided file.
	VariableName string      // The variable name the type is assigned.
	Fields       []*Field    // The fields of the type.
	Options      TypeOptions // The type options used for the type.
}

Type represents a type that contains fields to be copied to/from.

type TypeOptions

type TypeOptions struct {
	Import   string                 // The import path for the type.
	Pointer  bool                   // Whether the type should be used with a pointer.
	Depth    int                    // The level fields should be copied to/from.
	Deepcopy string                 // Whether the type should be deepcopied.
	Custom   map[string]interface{} // The custom options of a function.
}

TypeOptions represent options for a Type.

Jump to

Keyboard shortcuts

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