tags

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Text is the home-page group for text formatting / conversion /
	// manipulation tools.
	Text = tool.DefaultTag{
		Name:        "Text",
		Description: "Text formatting, conversion, and manipulation.",
		IsGroup:     true,
		SortOrder:   10,
	}

	// API groups developer-facing API tooling: request builders, mocking
	// servers, anything that helps poke at HTTP endpoints.
	API = tool.DefaultTag{
		Name:        "API",
		Description: "Build, mock, and inspect HTTP APIs.",
		IsGroup:     true,
		SortOrder:   30,
	}

	// Job groups background jobs that run on a cron schedule or are
	// triggered manually.
	Job = tool.DefaultTag{
		Name:        "Job",
		Description: "Background jobs with cron scheduling.",
		IsGroup:     true,
		SortOrder:   90,
	}
)

Default tag catalog. Add new shared tags here so every tool references the same spec — rename/flag changes happen in one place, and adding a tag to a tool is just appending `tags.Foo` to Meta().DefaultTags.

Seeding rules (see tags.Service.EnsureToolDefaultTags):

  • A tag with a given Name is created once. Existing tags keep their flags — editing IsGroup/IsFilter here does NOT mutate an existing row. Change the flags from /admin/tags instead.
  • Links to a tool are written only on the first registration of that tool (no tool_tag rows yet). Admin unlinks survive restarts.

Functions

This section is empty.

Types

type Service

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

func NewService

func NewService(db *gorm.DB) *Service

func (*Service) EnsureToolDefaultTags

func (s *Service) EnsureToolDefaultTags(ctx context.Context, toolPath string, defaults []tool.DefaultTag) error

EnsureToolDefaultTags seeds DefaultTags for a tool on startup. For each spec it ensures the global tag exists by name (creating it with the declared flags if missing; existing tags are left untouched). It then links every spec tag to toolPath only when the tool has *no* tool_tag rows yet — so an admin who later unlinks a tag won't see it return after a restart.

func (*Service) GroupTags

func (s *Service) GroupTags(ctx context.Context) ([]*entity.Tag, error)

GroupTags returns tags that should render as groups on the home page, ordered by sort_order then name.

func (*Service) ToolTagIDs

func (s *Service) ToolTagIDs(ctx context.Context, toolPaths []string) (map[string][]string, error)

ToolTagIDs returns a map from tool_path to the list of tag ids it has.

Jump to

Keyboard shortcuts

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