extractor

package
v0.0.0-...-6c6fd4c Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package extractor enumerating the files and extracting the looks-like-enum lines

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(
	pkgs []*packages.Package,
	fset *token.FileSet,
	enumName StringMatcher,
) map[Package][]Enum

Extract the enum constants relative records.

func ForEach

func ForEach[R any](
	pkgs []*packages.Package,
	fset *token.FileSet,
	extract func(ast.Decl, map[ast.Expr]types.TypeAndValue) []R,
	merge func([]R, []R) []R,
) map[Package][]R

ForEach is going through the packages calling extract function for each declaration found and combining the records extracted per package using the merge function.

Types

type Enum

type Enum struct {
	Name     string
	BaseType string
	Values   []string
}

Enum describes the enum type.

type Package

type Package struct {
	Name   string
	IsTest bool
	Dir    string
}

Package describes the package enum was found.

type StringMatcher

type StringMatcher interface {
	MatchString(s string) bool
}

StringMatcher is a regexp compatible matcher.

Jump to

Keyboard shortcuts

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