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 ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.