gopium

package
Version: v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NAME    = "gopium"
	VERSION = "1.6.2"
	PKG     = "https://github.com/1pkg/gopium"
	STAMP   = "🌺 gopium @1pkg"
)

list of global registered gopium constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Apply

Apply defines abstraction for formatting original ast package by applying custom action accordingly to provided categorized collection

type Ast

type Ast func(*ast.TypeSpec, Struct) error

Ast defines abstraction for formatting original ast type spec accordingly to gopium struct

type AstParser

type AstParser interface {
	ParseAst(context.Context, ...byte) (*ast.Package, Locator, error)
}

AstParser defines abstraction for ast packages parsing processor

type Bytes

type Bytes func([]Struct) ([]byte, error)

Bytes defines abstraction for formatting gopium flat collection to byte slice

type Categorized

type Categorized interface {
	Full() map[string]Struct
	Cat(string) (map[string]Struct, bool)
}

Categorized defines abstraction for categorized structures collection

type CategoryWriter

type CategoryWriter interface {
	Category(string) error
	Writer
}

CategoryWriter defines abstraction for io witers generation with flexible category

type Comparator

type Comparator interface {
	Check(*ast.TypeSpec) (Struct, bool)
}

Comparator defines walker comparator abstraction that checks if ast type spec node needs to be visitted and returns relevant gopium struct and existing flag

type Curator

type Curator interface {
	SysWord() int64
	SysAlign() int64
	SysCache(level uint) int64
}

Curator defines system level info curator abstraction to expose system word, aligment and cache levels sizes

type Diff

type Diff func(Categorized, Categorized) ([]byte, error)

Diff defines abstraction for formatting gopium collections difference to byte slice

type Exposer

type Exposer interface {
	Name(types.Type) string
	Size(types.Type) int64
	Align(types.Type) int64
	Ptr(types.Type) int64
}

Exposer defines type info exposer abstraction to expose name, size and aligment for provided data type

type Field

type Field struct {
	Name     string   `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Type     string   `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Size     int64    `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Align    int64    `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Ptr      int64    `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Tag      string   `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Exported bool     `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Embedded bool     `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Doc      []string `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Comment  []string `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`

} // struct size: 122 bytes; struct align: 8 bytes; struct aligned size: 128 bytes; struct ptr scan size: 106 bytes; - 🌺 gopium @1pkg

Field defines single structure field data transfer object abstraction

type Locator

type Locator interface {
	ID(token.Pos) string
	Loc(token.Pos) string
	Locator(string) (Locator, bool)
	Fset(string, *token.FileSet) (*token.FileSet, bool)
	Root() *token.FileSet
}

Locator defines abstraction that helps to encapsulate pkgs file set related operations

type Maven

type Maven interface {
	Curator
	Exposer
}

Maven defines abstraction that aggregates curator and exposer abstractions

type Parser

type Parser interface {
	TypeParser
	AstParser
}

Parser defines abstraction that aggregates ast and type parsers abstractions

type Persister

type Persister interface {
	Persist(context.Context, Printer, Writer, Locator, ast.Node) error
}

Persister defines abstraction for ast node pesister with provided printer to provided writer by provided locator

type Printer

type Printer interface {
	Print(context.Context, io.Writer, *token.FileSet, ast.Node) error
}

Printer defines abstraction for ast node printing function to io writer

type Runner

type Runner interface {
	Run(context.Context) error
}

Runner defines abstraction for gopium runner

type Strategy

type Strategy interface {
	Apply(context.Context, Struct) (Struct, error)
}

Strategy defines custom action abstraction that applies some action payload on struct and returns resulted struct object or error

type StrategyBuilder

type StrategyBuilder interface {
	Build(...StrategyName) (Strategy, error)
}

StrategyBuilder defines strategy builder abstraction that helps to create single strategy by strategies names

type StrategyName

type StrategyName string

StrategyName defines registered strategy name abstraction used by StrategyBuilder to build registered strategies

type Struct

type Struct struct {
	Name    string   `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Doc     []string `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Comment []string `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`
	Fields  []Field  `gopium:"filter_pads,struct_annotate_comment,add_tag_group_force"`

} // struct size: 88 bytes; struct align: 8 bytes; struct aligned size: 88 bytes; struct ptr scan size: 72 bytes; - 🌺 gopium @1pkg

Struct defines single structure data transfer object abstraction

type TypeParser

type TypeParser interface {
	ParseTypes(context.Context, ...byte) (*types.Package, Locator, error)
}

TypeParser defines abstraction for types packages parsing processor

type Visitor

type Visitor interface {
	Visit(*ast.TypeSpec, Struct) error
}

Visitor defines walker action abstraction that applies custom action on ast type spec node

type Walk

Walk defines ast walker function abstraction that walks through type spec ast nodes with provided comparator function and applies some custom action

type Walker

type Walker interface {
	Visit(context.Context, *regexp.Regexp, Strategy) error
}

Walker defines hierarchical walker abstraction that applies some strategy to code tree structures and modifies them or creates other related side effects

type WalkerBuilder

type WalkerBuilder interface {
	Build(WalkerName) (Walker, error)
}

WalkerBuilder defines walker builder abstraction that helps to create single walker by walker name

type WalkerName

type WalkerName string

WalkerName defines registered walker name abstraction used by walker builder to build registered walkers

type Writer

type Writer interface {
	Generate(string) (io.WriteCloser, error)
}

Writer defines abstraction for io witers generation

Jump to

Keyboard shortcuts

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