model

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapabilityLevel

type CapabilityLevel int

CapabilityLevel mirrors src/main/java/.../intelligence/CapabilityLevel.java. Used by language extractors to describe how thoroughly a feature/language is covered. Distinct from Confidence (per-edge confidence ladder) — capability is a property of an *extractor*, not a single fact.

const (
	// CapabilityExact - full semantic understanding (AST-level, cross-file).
	CapabilityExact CapabilityLevel = iota
	// CapabilityPartial - some constructs detected, others may be missed.
	CapabilityPartial
	// CapabilityLexicalOnly - lexical/text search only, no structural analysis.
	CapabilityLexicalOnly
	// CapabilityUnsupported - language or feature is not supported.
	CapabilityUnsupported
)

func ParseCapabilityLevel

func ParseCapabilityLevel(s string) (CapabilityLevel, error)

ParseCapabilityLevel is case-insensitive.

func (CapabilityLevel) MarshalJSON

func (c CapabilityLevel) MarshalJSON() ([]byte, error)

func (CapabilityLevel) String

func (c CapabilityLevel) String() string

func (*CapabilityLevel) UnmarshalJSON

func (c *CapabilityLevel) UnmarshalJSON(data []byte) error

type CodeEdge

type CodeEdge struct {
	ID         string         `json:"id"`
	Kind       EdgeKind       `json:"kind"`
	SourceID   string         `json:"source_id"`
	TargetID   string         `json:"target_id"`
	Confidence Confidence     `json:"confidence"`
	Source     string         `json:"source,omitempty"`
	Properties map[string]any `json:"properties"`
}

CodeEdge mirrors src/main/java/.../model/CodeEdge.java.

Unlike Java SDN, the Go side stores TargetID as a plain string, not a back-reference into a CodeNode. GraphBuilder reattaches edges to nodes during the flush phase.

func NewCodeEdge

func NewCodeEdge(id string, kind EdgeKind, sourceID, targetID string) *CodeEdge

type CodeNode

type CodeNode struct {
	ID          string         `json:"id"`
	Kind        NodeKind       `json:"kind"`
	Label       string         `json:"label"`
	FQN         string         `json:"fqn,omitempty"`
	Module      string         `json:"module,omitempty"`
	FilePath    string         `json:"file_path,omitempty"`
	LineStart   int            `json:"line_start,omitempty"`
	LineEnd     int            `json:"line_end,omitempty"`
	Layer       Layer          `json:"layer"`
	Confidence  Confidence     `json:"confidence"`
	Source      string         `json:"source,omitempty"`
	Annotations []string       `json:"annotations"`
	Properties  map[string]any `json:"properties"`
}

CodeNode mirrors src/main/java/.../model/CodeNode.java.

Field naming follows snake_case JSON for parity-diffing against a normalized SQLite dump. The Java side uses Jackson defaults (camelCase) but the parity harness normalizes both sides via a shared shape (see parity/normalize.go), so what matters is internal consistency on the Go side.

func NewCodeNode

func NewCodeNode(id string, kind NodeKind, label string) *CodeNode

NewCodeNode constructs a node with required fields populated and slices/maps pre-allocated. Defaults Confidence to LEXICAL and Layer to LayerUnknown, matching Java behaviour.

type Confidence

type Confidence int

Confidence is the three-tier confidence ladder: pattern → structure → resolved. Values are ordered such that LEXICAL < SYNTACTIC < RESOLVED — direct integer comparison matches the Java Comparable contract.

const (
	ConfidenceLexical   Confidence = iota // regex / textual pattern only
	ConfidenceSyntactic                   // AST / parse tree match
	ConfidenceResolved                    // resolved via SymbolResolver
)

func ParseConfidence

func ParseConfidence(s string) (Confidence, error)

ParseConfidence is case-insensitive.

func (Confidence) MarshalJSON

func (c Confidence) MarshalJSON() ([]byte, error)

func (Confidence) Score

func (c Confidence) Score() float64

Score returns the canonical numeric mapping from the Java side: LEXICAL=0.6, SYNTACTIC=0.8, RESOLVED=0.95.

func (Confidence) String

func (c Confidence) String() string

func (*Confidence) UnmarshalJSON

func (c *Confidence) UnmarshalJSON(data []byte) error

type EdgeKind

type EdgeKind int

EdgeKind enumerates the 28 edge types in the codeiq graph. String values MUST match the Java EdgeKind enum 1:1 (see src/main/java/io/github/randomcodespace/iq/model/EdgeKind.java).

const (
	EdgeDependsOn EdgeKind = iota
	EdgeImports
	EdgeExtends
	EdgeImplements
	EdgeCalls
	EdgeInjects
	EdgeExposes
	EdgeQueries
	EdgeMapsTo
	EdgeProduces
	EdgeConsumes
	EdgePublishes
	EdgeListens
	EdgeInvokesRMI
	EdgeExportsRMI
	EdgeReadsConfig
	EdgeMigrates
	EdgeContains
	EdgeDefines
	EdgeOverrides
	EdgeConnectsTo
	EdgeTriggers
	EdgeProvisions
	EdgeSendsTo
	EdgeReceivesFrom
	EdgeProtects
	EdgeRenders
	EdgeReferencesTable
)

func AllEdgeKinds

func AllEdgeKinds() []EdgeKind

func ParseEdgeKind

func ParseEdgeKind(s string) (EdgeKind, error)

func (EdgeKind) MarshalJSON

func (k EdgeKind) MarshalJSON() ([]byte, error)

func (EdgeKind) String

func (k EdgeKind) String() string

func (*EdgeKind) UnmarshalJSON

func (k *EdgeKind) UnmarshalJSON(data []byte) error

type Layer

type Layer int

Layer is the five-way layer classification stamped by LayerClassifier (phase 2). Phase 1 detectors emit LayerUnknown; classification is deferred to phase 2's analyzer.LayerClassifier.

const (
	LayerFrontend Layer = iota
	LayerBackend
	LayerInfra
	LayerShared
	LayerUnknown
)

func AllLayers

func AllLayers() []Layer

func ParseLayer

func ParseLayer(s string) (Layer, error)

func (Layer) MarshalJSON

func (l Layer) MarshalJSON() ([]byte, error)

func (Layer) String

func (l Layer) String() string

func (*Layer) UnmarshalJSON

func (l *Layer) UnmarshalJSON(data []byte) error

type NodeKind

type NodeKind int

NodeKind enumerates the 34 node types in the codeiq graph. String values MUST match the Java NodeKind enum 1:1 (see src/main/java/io/github/randomcodespace/iq/model/NodeKind.java).

const (
	NodeModule NodeKind = iota
	NodePackage
	NodeClass
	NodeMethod
	NodeEndpoint
	NodeEntity
	NodeRepository
	NodeQuery
	NodeMigration
	NodeTopic
	NodeQueue
	NodeEvent
	NodeRMIInterface
	NodeConfigFile
	NodeConfigKey
	NodeWebSocketEndpoint
	NodeInterface
	NodeAbstractClass
	NodeEnum
	NodeAnnotationType
	NodeProtocolMessage
	NodeConfigDefinition
	NodeDatabaseConnection
	NodeAzureResource
	NodeAzureFunction
	NodeMessageQueue
	NodeInfraResource
	NodeComponent
	NodeGuard
	NodeMiddleware
	NodeHook
	NodeService
	NodeExternal
	NodeSQLEntity
)

func AllNodeKinds

func AllNodeKinds() []NodeKind

AllNodeKinds returns every NodeKind in declaration order.

func ParseNodeKind

func ParseNodeKind(s string) (NodeKind, error)

ParseNodeKind looks up a NodeKind by its canonical string value.

func (NodeKind) MarshalJSON

func (k NodeKind) MarshalJSON() ([]byte, error)

MarshalJSON emits the canonical string value.

func (NodeKind) String

func (k NodeKind) String() string

String returns the canonical lowercase value.

func (*NodeKind) UnmarshalJSON

func (k *NodeKind) UnmarshalJSON(data []byte) error

UnmarshalJSON parses the canonical string value.

Jump to

Keyboard shortcuts

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