annotation

package module
v1.0.0-beta.17 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 11 Imported by: 2

README

annotation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(logger Logger)

Types

type Annotation

type Annotation struct {
	Name  string
	Value string
	Map   map[string]interface{}
}

func NewAnnotation

func NewAnnotation(name string, value string) Annotation

func (*Annotation) Decode

func (m *Annotation) Decode(a interface{}) error

func (*Annotation) RawValue

func (m *Annotation) RawValue() string

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

func Collect

func Collect(options ...Option) (*Collector, error)

func (*Collector) Entries

func (c *Collector) Entries() []Entry

func (*Collector) EntriesWith

func (c *Collector) EntriesWith(annotation string) []Entry

func (*Collector) EntriesWithArgType

func (c *Collector) EntriesWithArgType(annotationName string, argumentType string) []Entry

func (*Collector) EntriesWithPrefix

func (c *Collector) EntriesWithPrefix(prefix string) []Entry

func (*Collector) EntriesWithResultType

func (c *Collector) EntriesWithResultType(annotation string, result string) []Entry

type DefaultLogger

type DefaultLogger struct{}

func (DefaultLogger) Debug

func (n DefaultLogger) Debug(args ...interface{})

func (DefaultLogger) Debugf

func (n DefaultLogger) Debugf(format string, args ...interface{})

func (DefaultLogger) Error

func (n DefaultLogger) Error(args ...interface{})

func (DefaultLogger) Errorf

func (n DefaultLogger) Errorf(format string, args ...interface{})

func (DefaultLogger) Fatal

func (n DefaultLogger) Fatal(args ...interface{})

func (DefaultLogger) Fatalf

func (n DefaultLogger) Fatalf(format string, args ...interface{})

func (DefaultLogger) Info

func (n DefaultLogger) Info(args ...interface{})

func (DefaultLogger) Infof

func (n DefaultLogger) Infof(format string, args ...interface{})

func (DefaultLogger) Panic

func (n DefaultLogger) Panic(args ...interface{})

func (DefaultLogger) Panicf

func (n DefaultLogger) Panicf(format string, args ...interface{})

func (DefaultLogger) Trace

func (n DefaultLogger) Trace(args ...interface{})

func (DefaultLogger) Tracef

func (n DefaultLogger) Tracef(format string, args ...interface{})

func (DefaultLogger) Warn

func (n DefaultLogger) Warn(args ...interface{})

func (DefaultLogger) Warnf

func (n DefaultLogger) Warnf(format string, args ...interface{})

type Entry

type Entry struct {
	Header      EntryHeader // Metadata for the entry
	Comments    []string
	Module      string       // Name of the module where the entry is located
	File        string       // Name of the file where the entry is located
	Path        string       // Path to the file where the entry is located
	Package     string       // Name of the package where the entry is located
	Func        EntryFunc    // Details about the function in the entry
	Struct      string       // Name of the struct in the entry
	Annotations []Annotation // Annotations for the entry
}

Entry represents a single entry parsed from the *ast.File.

func (*Entry) IsFunc

func (b *Entry) IsFunc() bool

func (*Entry) IsMethod

func (b *Entry) IsMethod() bool

func (*Entry) IsStruct

func (b *Entry) IsStruct() bool

type EntryFunc

type EntryFunc struct {
	Name       string          // Name of the function
	Parameters []EntryFuncType // Parameters of the function
	Results    []EntryFuncType // Results of the function
}

EntryFunc represents a function and its details.

type EntryFuncType

type EntryFuncType struct {
	Name string // Name of the parameter/result
	Type string // Type of the parameter/result
}

EntryFuncType represents a parameter or a result type of a function.

type EntryHeader

type EntryHeader struct {
	Title       string // Title of the entry
	Description string // Description of the entry
}

EntryHeader represents the metadata for an entry.

type Logger

type Logger interface {
	Tracef(format string, args ...interface{})

	Trace(args ...interface{})

	Debugf(format string, args ...interface{})

	Debug(args ...interface{})

	Infof(format string, args ...interface{})

	Info(args ...interface{})

	Warnf(format string, args ...interface{})

	Warn(args ...interface{})

	Errorf(format string, args ...interface{})

	Error(args ...interface{})

	Fatalf(format string, args ...interface{})

	Fatal(args ...interface{})

	Panicf(format string, args ...interface{})

	Panic(args ...interface{})
}

Logger is our contract for the logger.

func NewLogger

func NewLogger() Logger

type Option

type Option func(*Collector) error

func WithFilters

func WithFilters(filters ...string) Option

func WithPackages

func WithPackages(pkgs ...string) Option

func WithPath

func WithPath(path string) Option

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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