mirror

package module
v0.0.0-...-69a7c56 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDefaultApp

func CreateDefaultApp(name string, runFunc RunFunc) *cli.App

CreateDefaultApp returns default flag configuration for bundled apps

func RunDefaultApp

func RunDefaultApp(name string, runFunc RunFunc) error

RunDefaultApp will automatically run the defaultly bundled application

Types

type RawStructFieldType

type RawStructFieldType struct {
	Value reflect.Value
	Field reflect.StructField
	Typ   reflect.Type
}

RawStructFieldType is returned by the RawFields as an array of key-value pairs (as map can't be indexed by full structure and reflect.StuctField is used without pointers across reflect)

func (*RawStructFieldType) Exported

func (f *RawStructFieldType) Exported() bool

Exported returns true if the field is exported within the struct

type RunFunc

type RunFunc func(StructSlice, *Writer, *packages.Package) error

RunFunc is a callback that will be called when the app bootstrap finishes

type Struct

type Struct struct {
	Ref interface{}

	// OriginalPackage can be overridden by package copiers to set the original package path
	// if the package has changed due to movement of the Ref
	// This is mainly used by the CreateDefaultApp when it's copying the package over to the cache
	OriginalPackage string
}

Struct is a wrapper for the runtime symbol Ref

func ReflectStruct

func ReflectStruct(s interface{}) *Struct

ReflectStruct creates a mirror Struct that enables users to use mirror-enhanced reflections

func (*Struct) Fields

func (s *Struct) Fields() map[string]string

Fields returns a map of Name:Type pairs which can be used directly when generating new code

func (*Struct) Name

func (s *Struct) Name() string

Name returns the name of an underlying type for a given reflection. Note that this does not return pointer type asterixes nor package names

func (*Struct) PkgPath

func (s *Struct) PkgPath() string

PkgPath returns the import path for the current reflection

func (*Struct) RawFields

func (s *Struct) RawFields() []RawStructFieldType

RawFields returns all fields of a given reflection type

type StructSlice

type StructSlice []*Struct

StructSlice is a slice of pointers to Struct, used to do multi-struct operations

func ReflectStructs

func ReflectStructs(ss ...interface{}) StructSlice

ReflectStructs is a plural function for ReflectStruct

func (StructSlice) Each

Each loops over the StructSlice and calls the callback for each of its elements returning itself at the end

func (StructSlice) PkgPaths

func (s StructSlice) PkgPaths() []string

PkgPath returns the import path for the current reflection

type StructSliceEachFunc

type StructSliceEachFunc func(s *Struct)

StructSliceEachFunc is a type for Each method above StructSlice

type Writer

type Writer = bundle.Writer

Writer is an alias for the underlying bundle.Writer type, hidden with its implementation details

Directories

Path Synopsis
bundles
functional command
hijacker command
examples
pkg
cp

Jump to

Keyboard shortcuts

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