humanize

package module
v0.0.0-...-a47bf6a Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2018 License: MIT Imports: 13 Imported by: 0

README

humanize

Build Status Coverage Status GoDoc Go Report Card

This code is heavily under development, and ANYTHING may change.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	Slice bool
	Len   int
	Type  Type
	// contains filtered or unexported fields
}

ArrayType is the base array

func (*ArrayType) Equal

func (a *ArrayType) Equal(t Type) bool

Equal check array type equality

func (*ArrayType) Package

func (a *ArrayType) Package() *Package

Package return the array package

func (*ArrayType) String

func (a *ArrayType) String() string

String represent array in string

type ChannelType

type ChannelType struct {
	Direction ast.ChanDir
	Type      Type
	// contains filtered or unexported fields
}

ChannelType is the channel type in go source code

func (*ChannelType) Equal

func (c *ChannelType) Equal(t Type) bool

Equal check if two channel are exported

func (*ChannelType) Package

func (c *ChannelType) Package() *Package

Package is the package of channel

func (*ChannelType) String

func (c *ChannelType) String() string

String represent string version of the data

type Constant

type Constant struct {
	Name  string
	Type  Type
	Docs  Docs
	Value string
	// contains filtered or unexported fields
}

Constant is a string represent of a function parameter

func (*Constant) Equal

func (c *Constant) Equal(t *Constant) bool

Equal check for equality TODO : currently it check if the value is equal and the type is equal too.

func (*Constant) String

func (c *Constant) String() string

String is the constant in go source code

type Docs

type Docs []string

Docs is the code documents

func (Docs) String

func (d Docs) String() string

String convert object to go docs again

type EllipsisType

type EllipsisType struct {
	*ArrayType
}

EllipsisType is slice type but with ...type definition

func (EllipsisType) Equal

func (e EllipsisType) Equal(t Type) bool

Equal if two ellipsis array are equal

func (*EllipsisType) String

func (e *EllipsisType) String() string

String represent ellipsis array in string

type Embed

type Embed struct {
	Type
	Docs Docs
	Tags reflect.StructTag
}

Embed is the embedded type in the struct or interface

type Embeds

type Embeds []*Embed

Embeds is a list of embedded items

func (Embeds) Equal

func (e Embeds) Equal(t Embeds) bool

Equal check for equality for two embedded item

type Field

type Field struct {
	Name string
	Type Type
	Docs Docs
	Tags reflect.StructTag
}

Field is a single field of a structure, a variable, with tag

type Fields

type Fields []*Field

Fields a list of fields

func (Fields) Equal

func (f Fields) Equal(t Fields) bool

Equal check fields equality

type File

type File struct {
	FileName    string
	PackageName string

	Docs      Docs
	Imports   []*Import
	Variables []*Variable
	Functions []*Function
	Constants []*Constant
	Types     []*TypeName
}

File is a single file in a structure

func ParseFile

func ParseFile(src string, p *Package) (*File, error)

ParseFile try to parse a single file for its annotations

func (*File) FindConstant

func (f *File) FindConstant(t string) (*Constant, error)

FindConstant try to find constant in package

func (*File) FindFunction

func (f *File) FindFunction(t string) (*Function, error)

FindFunction try to find function in file

func (*File) FindImport

func (f *File) FindImport(pkg string) (*Import, error)

FindImport try to find an import in a file

func (*File) FindType

func (f *File) FindType(t string) (*TypeName, error)

FindType try to find type in file

func (*File) FindVariable

func (f *File) FindVariable(t string) (*Variable, error)

FindVariable try to find variable in file

type FuncType

type FuncType struct {
	Parameters []*Variable
	Results    []*Variable
	// contains filtered or unexported fields
}

FuncType is the single function

func (*FuncType) Equal

func (f *FuncType) Equal(t Type) bool

Equal check func type equality

func (*FuncType) Package

func (f *FuncType) Package() *Package

Package is the func package

func (*FuncType) Sign

func (f *FuncType) Sign() string

Sign return the function sign

func (*FuncType) String

func (f *FuncType) String() string

String is the string representation of func type

type Function

type Function struct {
	Name     string
	Docs     Docs
	Type     *FuncType
	Receiver *Variable // Nil means normal function
	// contains filtered or unexported fields
}

Function is functions with name, not the func types

func (*Function) Equal

func (f *Function) Equal(t *Function) bool

Equal check if two functions are equal

func (*Function) File

func (f *Function) File() *File

File get the file of function

func (*Function) Package

func (f *Function) Package() *Package

Package get the package of function

func (*Function) String

func (f *Function) String() string

String convert function object to go code

type IdentType

type IdentType struct {
	Ident string
	// contains filtered or unexported fields
}

IdentType is the normal type name

func (*IdentType) Equal

func (i *IdentType) Equal(t Type) bool

Equal check if two ident are equal

func (*IdentType) Package

func (i *IdentType) Package() *Package

Package get the package of ident

func (*IdentType) String

func (i *IdentType) String() string

type Import

type Import struct {
	Package   string
	Canonical string
	Path      string
	Docs      Docs

	Folder string
	// contains filtered or unexported fields
}

Import is one imported path

func (Import) LoadPackage

func (i Import) LoadPackage() (*Package, error)

LoadPackage is the function to load import package

func (*Import) String

func (i *Import) String() string

type InterfaceType

type InterfaceType struct {
	Functions []*Function
	Embeds    []Type // IdentType or SelectorType
	// contains filtered or unexported fields
}

InterfaceType is the interface in go code

func (*InterfaceType) Equal

func (i *InterfaceType) Equal(t Type) bool

Equal if both interfaces are equal

func (*InterfaceType) Package

func (i *InterfaceType) Package() *Package

Package get the interface package

func (*InterfaceType) String

func (i *InterfaceType) String() string

type MapType

type MapType struct {
	Key   Type
	Value Type
	// contains filtered or unexported fields
}

MapType is the map in the go code

func (*MapType) Equal

func (m *MapType) Equal(t Type) bool

Equal check if the type is equal?

func (*MapType) Package

func (m *MapType) Package() *Package

Package return the map package

func (*MapType) String

func (m *MapType) String() string

type Package

type Package struct {
	Path string
	Name string

	Files []*File
}

Package is the package in one place

func ParsePackage

func ParsePackage(path string, packages ...string) (*Package, error)

ParsePackage is here for loading a single package and parse all files in it if the package is imported from another package, the other parameter is required for checking vendors of that package.

func (*Package) Bind

func (p *Package) Bind() error

Bind try to bind package. this check every type and bind them to actual value

func (*Package) Equal

func (p *Package) Equal(t *Package) bool

Equal check if to packages are equal

func (*Package) FindConstant

func (p *Package) FindConstant(t string) (*Constant, error)

FindConstant try to find constant in package

func (*Package) FindFunction

func (p *Package) FindFunction(t string) (*Function, error)

FindFunction try to find function in package

func (*Package) FindImport

func (p *Package) FindImport(pkg string) (*Import, error)

FindImport try to find an import in a package

func (*Package) FindType

func (p *Package) FindType(t string) (*TypeName, error)

FindType try to find type in package

func (*Package) FindVariable

func (p *Package) FindVariable(t string) (*Variable, error)

FindVariable try to find variable in package

type SelectorType

type SelectorType struct {
	Type Type
	// contains filtered or unexported fields
}

SelectorType is the type in another package

func (*SelectorType) Equal

func (s *SelectorType) Equal(t Type) bool

Equal if two types are equal

func (*SelectorType) Package

func (s *SelectorType) Package() *Package

Package is the package of selector

func (*SelectorType) String

func (s *SelectorType) String() string

func (*SelectorType) TargetPackage

func (s *SelectorType) TargetPackage() (*Package, error)

TargetPackage is the selector target package

type StarType

type StarType struct {
	Target Type
	// contains filtered or unexported fields
}

StarType is the pointer of a type

func (*StarType) Equal

func (s *StarType) Equal(t Type) bool

Equal check if two star type are equal

func (*StarType) Package

func (s *StarType) Package() *Package

Package get the package name

func (*StarType) String

func (s *StarType) String() string

type StructType

type StructType struct {
	Fields Fields
	Embeds Embeds
	// contains filtered or unexported fields
}

StructType is the structures in golang source code

func (*StructType) Equal

func (s *StructType) Equal(t Type) bool

Equal check structs equality

func (*StructType) Package

func (s *StructType) Package() *Package

Package return the package of this struct

func (*StructType) String

func (s *StructType) String() string

String convert struct to string

type Type

type Type interface {
	fmt.Stringer
	// Package return the package name of the type
	Package() *Package

	Equal(Type) bool
}

Type is the interface for all types without name

type TypeName

type TypeName struct {
	Docs Docs
	Type Type
	Name string

	Methods     []*Function
	StarMethods []*Function
	// contains filtered or unexported fields
}

TypeName is the type with name in a package

func FindTypeName

func FindTypeName(t Type) (*TypeName, error)

FindTypeName try to find type name based on the type. it can fail for anonymous types, so watch about the result

func (*TypeName) Equal

func (tn *TypeName) Equal(t *TypeName) bool

Equal if two type name are equal

func (*TypeName) File

func (tn *TypeName) File() *File

File return the filename of this type name

func (*TypeName) InstanceOf

func (tn *TypeName) InstanceOf(t Type, samePkg bool) (bool, bool)

InstanceOf if this type is instance of some other type

func (*TypeName) Package

func (tn *TypeName) Package() *Package

Package return the package name of this type name

func (*TypeName) String

func (tn *TypeName) String() string

type Variable

type Variable struct {
	Name string
	Type Type
	Docs Docs
	// contains filtered or unexported fields
}

Variable is a string represent of a function parameter

func (*Variable) Equal

func (v *Variable) Equal(t *Variable) bool

Equal if two variables are equal

func (*Variable) File

func (v *Variable) File() *File

File the filename of this variable

func (*Variable) Package

func (v *Variable) Package() *Package

Package the package name of this variable

func (*Variable) String

func (v *Variable) String() string

Directories

Path Synopsis
fixture

Jump to

Keyboard shortcuts

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