looker

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeGob

func EncodeGob(output string, pkg *Package) error

func IsProcessRower added in v0.6.0

func IsProcessRower(s interface{}) bool

func LookAtFuncParameters

func LookAtFuncParameters(mt reflect.Type) (Parameters, Parameters)

Types

type Field

type Field struct {
	// See the fields that describe Req struct.
	// type Req struct {
	//	ID   int64 `sql:"id"`
	// }
	// for Req.ID Name contains `ID`.
	Name string
	// ImportPath contains ImportElement.
	ImportPath ImportElement
	// for Req.ID BaseType contains `int64`.
	BaseType string
	// UserType contains type other then basic if it's defined otherwise basic.
	UserType string
	// Anonymous sets to true if field contains anonymous nested struct.
	Anonymous bool
	// Tag contains the value for tag with name `sql` if it's presented.
	Tag string
	// todo
	Parents []string
}

Field describes the fields of struct after reflection.

func (Field) ColumnName added in v0.4.0

func (f Field) ColumnName() string

ColumnName returns the column name to use for mapping with sql response.

func (Field) Path added in v0.12.0

func (f Field) Path() string

type Fields

type Fields []Field

Fields is alias for slice of Field.

func LookAtField

func LookAtField(ft reflect.StructField) Fields

LookAtField receive the reflected object of struct field and return Fields. If field points to anonymous struct then LookAtFields will be called.

func LookAtFields

func LookAtFields(st reflect.Type) Fields

LookAtFields receives the reflect.Type object of struct and returns the Fields.

type ImportElement

type ImportElement struct {
	Path  string
	Alias string
}

ImportElement represents the imported package. Attribute `Alias` represents the optional alias for the package.

import foo "github.com/fooooo/baaaar-pppkkkkggg"

func GetImportElement added in v0.11.0

func GetImportElement(typ reflect.Type) ImportElement

func (ImportElement) Name

func (ie ImportElement) Name() string

type Interface

type Interface struct {
	ImportPath ImportElement
	UserType   string
	Methods    Methods
}

func LookAtInterface

func LookAtInterface(typ reflect.Type) *Interface

func (*Interface) ImplementationName added in v0.9.1

func (intf *Interface) ImplementationName(prefix string) string

func (*Interface) ImportPaths added in v0.11.0

func (intf *Interface) ImportPaths() []string

func (*Interface) Name

func (intf *Interface) Name(dstPath string) string

type InterfaceElement added in v0.2.0

type InterfaceElement struct {
	ImportPath ImportElement
	UserType   string
}

func (*InterfaceElement) ImportPaths added in v0.11.0

func (prm *InterfaceElement) ImportPaths() []string

func (*InterfaceElement) Kind added in v0.2.0

func (prm *InterfaceElement) Kind() string

func (*InterfaceElement) Name added in v0.2.0

func (prm *InterfaceElement) Name(dstPath string) string

func (*InterfaceElement) Pointer added in v0.2.0

func (prm *InterfaceElement) Pointer() bool

type Interfaces

type Interfaces []*Interface

type Method

type Method struct {
	Name string
	In   Parameters
	Out  Parameters
}

func (*Method) ImportPaths added in v0.11.0

func (m *Method) ImportPaths() []string

type Methods

type Methods []*Method

type Package

type Package struct {
	ImportPath ImportElement
	Interfaces Interfaces
}

func LookAtInterfaces

func LookAtInterfaces(pkgPath string, is []reflect.Type) *Package

func Reflect

func Reflect(importPath string, symbols []string) (*Package, error)

func (*Package) ImportPaths added in v0.11.0

func (p *Package) ImportPaths() []string

type Parameter

type Parameter interface {
	Kind() string
	Name(dstPath string) string
	Pointer() bool
	ImportPaths() []string
}

func LookAtParameter

func LookAtParameter(at reflect.Type) Parameter

type Parameters

type Parameters []Parameter

type SliceElement added in v0.2.0

type SliceElement struct {
	ImportPath ImportElement
	UserType   string
	Item       Parameter
	IsPointer  bool
}

func (*SliceElement) ImportPaths added in v0.11.0

func (prm *SliceElement) ImportPaths() []string

func (*SliceElement) Kind added in v0.2.0

func (prm *SliceElement) Kind() string

func (*SliceElement) Name added in v0.2.0

func (prm *SliceElement) Name(dstPath string) string

func (*SliceElement) Pointer added in v0.2.0

func (prm *SliceElement) Pointer() bool

type StructElement

type StructElement struct {
	ImportPath   ImportElement
	UserType     string
	IsPointer    bool
	Fields       Fields
	ProcessRower bool
}

Use exported fields because god.Encoder

func (*StructElement) ImportPaths added in v0.11.0

func (prm *StructElement) ImportPaths() []string

todo: import path for fields

func (*StructElement) Kind

func (prm *StructElement) Kind() string

func (*StructElement) Name

func (prm *StructElement) Name(dstPath string) string

func (*StructElement) Pointer

func (prm *StructElement) Pointer() bool

type UnsupportedElement added in v0.2.0

type UnsupportedElement struct {
	ImportPath ImportElement
	UserType   string
	BaseType   string
	IsPointer  bool
}

func (*UnsupportedElement) ImportPaths added in v0.11.0

func (prm *UnsupportedElement) ImportPaths() []string

func (*UnsupportedElement) Kind added in v0.2.0

func (prm *UnsupportedElement) Kind() string

func (*UnsupportedElement) Name added in v0.2.0

func (prm *UnsupportedElement) Name(dstPath string) string

func (*UnsupportedElement) Pointer added in v0.2.0

func (prm *UnsupportedElement) Pointer() bool

Jump to

Keyboard shortcuts

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