package util

import "github.com/purpleidea/mgmt/docs/util"

Package util handles metadata for documentation generation.

Index

Functions

func RegisterFunction

func RegisterFunction(name string, metadata *Metadata) error

RegisterFunction records the metadata for a function of this name.

func RegisterResource

func RegisterResource(kind string, metadata *Metadata) error

RegisterResource records the metadata for a resource of this kind.

Types

type Metadata

type Metadata struct {
	// Filename is the filename (without any base dir path) that this is in.
	Filename string

	// Typename is the string name of the main resource struct or function.
	Typename string
}

Metadata stores some additional information about the function or resource. This is used to automatically generate documentation.

func LookupFunction

func LookupFunction(name string) (*Metadata, error)

LookupFunction looks up the metadata for a function of this name.

func LookupResource

func LookupResource(kind string) (*Metadata, error)

LookupResource looks up the metadata for a resource of this kind.

func (*Metadata) GetMetadata

func (obj *Metadata) GetMetadata() *Metadata

GetMetadata returns some metadata about the func. It can be called at any time. This must not be named the same as the struct it's on or using it as an anonymous embedded struct will stop us from being able to call this method.

Source Files

metadata.go

Version
v0.0.0-20250322185616-c50a578426f1 (latest)
Published
Mar 22, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
4 days ago

Tools for package owners.