model

package
v0.0.0-...-02fd228 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: GPL-3.0 Imports: 0 Imported by: 0

README

Codeform Model

The Model represents the source code for entire Go projects.

Documentation

Overview

Package model contains the types that describe Go code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args []Var

Args represents a set of argument variables.

type Code

type Code struct {
	// Packages represents a list of packages.
	Packages []Package `json:"packages"`
	// TargetPackageName is the name of the target package.
	TargetPackageName string
}

Code represents the Go code as a data model.

type Func

type Func struct {
	// Name is the name of the function.
	Name string `json:"name"`
	// Args represents the input arguments.
	Args Args `json:"args"`
	// ReturnArgs represents the output arguments.
	ReturnArgs Args `json:"returnArgs"`
	// Variadic indicates whether the final input argument is
	// variadic or not.
	Variadic bool `json:"variadic"`
}

Func represents a function.

type Import

type Import struct {
	Name string `json:"name"`
}

Import represents an imported package.

type Interface

type Interface struct {
	// Name is the name of the interface.
	Name string `json:"name"`
	// Fullname is the full code name of the interface.
	// It may be:
	//     package.Interface
	Fullname string `json:"fullname"`
	// Methods is the methods that make up this
	// interface.
	Methods []Func `json:"methods"`
}

Interface represents an interface.

type Package

type Package struct {
	// Name is the name of the package.
	Name string `json:"name"`
	// Imports is a list of packages that need importing.
	Imports []Import `json:"imports"`
	// Funcs represents the global functions.
	Funcs []Func `json:"funcs"`
	// Interfaces represents the global interfaces in the
	// package.
	Interfaces []Interface `json:"interfaces"`
	// Vars are the global variables defined in this
	// package.
	Vars []Var `json:"vars"`
	// Consts are the global constants defined in this
	// package.
	Consts []Var `json:"consts"`
	// Structs represents the global structs defined in this
	// package.
	Structs []Struct `json:"structs"`
}

Package represents a single Go package.

type Struct

type Struct struct {
	// Name is the name of the struct.
	Name string `json:"name"`
	// Fullname is the full code name of the struct.
	// It may be:
	//     package.Struct
	Fullname string `json:"fullname"`
	// Methods are the functions that have this struct as
	// its receiver.
	Methods []Func `json:"methods"`
	// Fields are the fields in this struct.
	Fields []Var `json:"fields"`
}

Struct represents a struct.

type Type

type Type struct {
	// Name is the name of the type.
	Name string `json:"name"`
	// Fullname is the full code name of the type.
	// It may be:
	//     package.Interface
	Fullname string `json:"fullname"`
}

Type represents a type.

type Var

type Var struct {
	// Name is the name of this variable.
	Name string `json:"name"`
	// Anonymous indicates whether the variable has
	// a name or not.
	Anonymous bool `json:"anonymous"`
	// Type is the type of this variable.
	Type Type `json:"type"`
	// Tag is the field tag for this variable or an empty
	// string if it doesn't have one.
	Tag string `json:"tag"`
	// Variadic indicates whether this argument is
	// variadic or not.
	Variadic bool `json:"variadic"`
}

Var represents a variable.

Jump to

Keyboard shortcuts

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