inspect

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InspectCmd = &cobra.Command{
	Use:   "inspect",
	Short: "Inspect Manglekit objects",
	Args:  cobra.NoArgs,
	Run: func(cmd *cobra.Command, args []string) {
		cmd.Help()
	},
}
View Source
var StructCmd = &cobra.Command{
	Use:   "struct",
	Short: "Inspect a struct and see the generated Mangle facts.",
	Long:  `Parses a JSON string or file representing a struct and uses the core reflection engine to generate Mangle Datalog facts. This helps users understand how Manglekit perceives their data structures.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		var jsonData []byte
		var err error

		if _, err := os.Stat(jsonFlag); err == nil {
			jsonData, err = os.ReadFile(jsonFlag)
			if err != nil {
				return fmt.Errorf("failed to read JSON file: %w", err)
			}
		} else {
			jsonData = []byte(jsonFlag)
		}

		var data map[string]any
		if err := json.Unmarshal(jsonData, &data); err != nil {
			return fmt.Errorf("failed to unmarshal JSON: %w", err)
		}

		facts, err := engine.ToFacts("request", data)
		if err != nil {
			return fmt.Errorf("failed to generate facts: %w", err)
		}

		for _, fact := range facts {
			fmt.Println(fact)
		}

		return nil
	},
}

Functions

func AddCommands

func AddCommands(rootCmd *cobra.Command)

Types

This section is empty.

Jump to

Keyboard shortcuts

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