model

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

@index GORM models for persisted automatic postprocess policy state.

@index GORM models for runtime schema compatibility checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildInheritsFingerprintV2

func BuildInheritsFingerprintV2(filePath, child, parent string) string

BuildInheritsFingerprintV2 encodes inherits edges with a versioned JSON payload. @intent provide an unambiguous fingerprint contract for inheritance edges across languages.

func IsCallKind

func IsCallKind(kind EdgeKind) bool

IsCallKind reports whether kind represents a call edge.

This helper keeps fallback call-kind handling centralized for traversal and filtering paths. @intent centralize call-kind handling for traversal and filtering paths.

func ParseInheritsFingerprint

func ParseInheritsFingerprint(filePath, fingerprint string) (child, parent string, ok bool)

ParseInheritsFingerprint decodes v2 fingerprints first and falls back to the legacy contract. @intent keep resolver compatibility while parsers migrate to the unambiguous inherits fingerprint format.

Types

type Annotation

type Annotation struct {
	ID        uint   `gorm:"primaryKey"`
	NodeID    uint   `gorm:"uniqueIndex;not null"`
	Summary   string `gorm:"size:1024"`
	Context   string `gorm:"size:2048"`
	RawText   string `gorm:"type:text"`
	CreatedAt time.Time
	UpdatedAt time.Time

	Tags []DocTag `gorm:"foreignKey:AnnotationID"`
}

Annotation은 코드 선언에 연결된 구조화된 주석이다. @intent 노드에 연결된 요약과 태그 메타데이터를 영속화한다.

type Community

type Community struct {
	ID          uint   `gorm:"primaryKey"`
	Namespace   string `gorm:"size:256;not null;default:'default';uniqueIndex:idx_community_ns_key"`
	Key         string `gorm:"size:512;not null;uniqueIndex:idx_community_ns_key"`
	Label       string `gorm:"size:256;not null"`
	Strategy    string `gorm:"size:32;not null;index"`
	Description string `gorm:"type:text"`
	CreatedAt   time.Time
	UpdatedAt   time.Time

	Members []CommunityMembership `gorm:"foreignKey:CommunityID"`
}

Community는 커뮤니티 분석 결과의 그룹 메타데이터를 저장한다. @intent 연관된 노드 집합을 전략별 커뮤니티 단위로 표현한다.

type CommunityMembership

type CommunityMembership struct {
	ID          uint `gorm:"primaryKey"`
	CommunityID uint `gorm:"not null;uniqueIndex:idx_community_node"`
	NodeID      uint `gorm:"not null;uniqueIndex:idx_community_node;index"`
	CreatedAt   time.Time
}

CommunityMembership는 노드와 커뮤니티의 소속 관계를 저장한다. @intent 특정 노드가 어떤 커뮤니티에 속하는지 연결한다.

type DocTag

type DocTag struct {
	ID           uint    `gorm:"primaryKey"`
	AnnotationID uint    `gorm:"not null;index"`
	Kind         TagKind `gorm:"size:32;not null;index"`
	Type         string  `gorm:"type:text"`
	Name         string  `gorm:"size:128"`
	Value        string  `gorm:"type:text;not null"`
	Ordinal      int     `gorm:"not null"`
	CreatedAt    time.Time
}

DocTag는 Annotation 내의 개별 태그이다. @intent 어노테이션의 단일 구조화 태그 항목을 표현한다. Type 필드는 YARD `@param [String] name ...` 또는 JSDoc `@param {string} name ...`에서 추출한 타입 문자열을 보관한다 (param/throws/return에서 사용). TypeScript/JSDoc 복합 타입(`Record<string, Array<{id: number, name: string}>>`)이 수백 바이트에 이를 수 있어 text로 지정.

type Edge

type Edge struct {
	ID          uint     `gorm:"primaryKey"`
	Namespace   string   `gorm:"size:256;not null;default:'default';index;uniqueIndex:idx_edges_namespace_fingerprint"`
	FromNodeID  uint     `gorm:"index"`
	ToNodeID    uint     `gorm:"index"`
	Kind        EdgeKind `gorm:"size:32;not null;index"`
	FilePath    string   `gorm:"size:1024;index"`
	Line        int
	Fingerprint string `gorm:"size:128;not null;uniqueIndex:idx_edges_namespace_fingerprint"`
	CreatedAt   time.Time

	FromNode Node `gorm:"foreignKey:FromNodeID;constraint:-"`
	ToNode   Node `gorm:"foreignKey:ToNodeID;constraint:-"`
}

Edge는 두 노드 사이의 방향성 관계를 저장한다. @intent 코드 그래프에서 선언 간 연결과 그 출처를 영속화한다.

type EdgeKind

type EdgeKind string

EdgeKind는 노드 간 관계의 종류를 나타낸다. @intent 그래프 엣지의 의미를 일관된 관계 타입으로 구분한다.

const (
	EdgeKindCalls         EdgeKind = "calls"
	EdgeKindFallbackCalls EdgeKind = "fallback_calls"
	EdgeKindImportsFrom   EdgeKind = "imports_from"
	EdgeKindInherits      EdgeKind = "inherits"
	EdgeKindImplements    EdgeKind = "implements"
	EdgeKindContains      EdgeKind = "contains"
	EdgeKindTestedBy      EdgeKind = "tested_by"
	EdgeKindDependsOn     EdgeKind = "depends_on"
	EdgeKindReferences    EdgeKind = "references"
)

func CallEdgeKinds

func CallEdgeKinds() []EdgeKind

CallEdgeKinds returns edge kinds that represent a callable relationship.

Fallback call resolution stores low-confidence edges as EdgeKindFallbackCalls, but callers that want to traverse call behavior should usually include both values. @intent centralize call-kind handling for traversal and filtering paths.

type Flow

type Flow struct {
	ID          uint   `gorm:"primaryKey"`
	Namespace   string `gorm:"size:256;not null;default:'default';index"`
	Name        string `gorm:"size:256;not null"`
	Description string `gorm:"type:text"`
	CreatedAt   time.Time

	Members []FlowMembership `gorm:"foreignKey:FlowID"`
}

Flow는 추적된 호출 흐름의 메타데이터를 저장한다. @intent 의미 있는 실행 흐름을 이름과 설명으로 식별한다.

type FlowMembership

type FlowMembership struct {
	ID        uint   `gorm:"primaryKey"`
	Namespace string `gorm:"size:256;not null;default:'default';index"`
	FlowID    uint   `gorm:"not null;index"`
	NodeID    uint   `gorm:"not null;index"`
	Ordinal   int    `gorm:"not null"`
}

FlowMembership는 흐름에 포함된 노드의 순서를 저장한다. @intent 특정 플로우를 구성하는 노드와 그 위치를 연결한다.

type Node

type Node struct {
	ID            uint     `gorm:"primaryKey"`
	Namespace     string   `gorm:"size:256;not null;default:'default';uniqueIndex:idx_ns_qn_fp_sl"`
	QualifiedName string   `gorm:"size:512;not null;uniqueIndex:idx_ns_qn_fp_sl"`
	Kind          NodeKind `gorm:"size:32;not null;index"`
	Name          string   `gorm:"size:256;not null"`
	FilePath      string   `gorm:"size:768;not null;index;uniqueIndex:idx_ns_qn_fp_sl"`
	StartLine     int      `gorm:"not null;uniqueIndex:idx_ns_qn_fp_sl"`
	EndLine       int      `gorm:"not null"`
	Hash          string   `gorm:"size:64"`
	Language      string   `gorm:"size:32;index"`
	CreatedAt     time.Time
	UpdatedAt     time.Time

	Annotation *Annotation `gorm:"foreignKey:NodeID"`
}

Node는 코드 그래프의 단일 선언 엔티티를 저장한다. @intent 파일 내 선언의 정체성과 위치 정보를 영속화한다.

type NodeKind

type NodeKind string

NodeKind는 그래프 노드의 선언 분류를 나타낸다. @intent 파싱된 선언을 검색과 분석에 필요한 종류로 구분한다.

const (
	NodeKindFile     NodeKind = "file"
	NodeKindPackage  NodeKind = "package"
	NodeKindClass    NodeKind = "class"
	NodeKindFunction NodeKind = "function"
	NodeKindType     NodeKind = "type"
	NodeKindTest     NodeKind = "test"
)

type PostprocessPolicyState

type PostprocessPolicyState struct {
	Namespace string    `gorm:"primaryKey;size:256"`
	Tool      string    `gorm:"primaryKey;size:64"`
	Policy    string    `gorm:"size:32;not null"`
	UpdatedAt time.Time `gorm:"not null"`
}

PostprocessPolicyState stores the latest effective postprocess policy per namespace and tool. @intent 자동 정책 엔진의 최신 판단 상태를 namespace/tool 단위로 유지한다.

func (PostprocessPolicyState) TableName

func (PostprocessPolicyState) TableName() string

TableName pins PostprocessPolicyState to the shared policy state table name. @intent keep migration-managed table names stable across refactors and GORM defaults.

type PostprocessRunLog

type PostprocessRunLog struct {
	ID           uint      `gorm:"primaryKey"`
	Namespace    string    `gorm:"size:256;not null;index:idx_pp_log_ns_tool_time,priority:1"`
	Tool         string    `gorm:"size:64;not null;index:idx_pp_log_ns_tool_time,priority:2"`
	Policy       string    `gorm:"size:32;not null"`
	Source       string    `gorm:"size:16;not null"`
	Status       string    `gorm:"size:16;not null"`
	FailedSteps  string    `gorm:"type:text;not null;default:'[]'"`
	SkippedSteps string    `gorm:"type:text;not null;default:'[]'"`
	CreatedAt    time.Time `gorm:"not null;index:idx_pp_log_ns_tool_time,priority:3,sort:desc"`
}

PostprocessRunLog appends the effective policy and outcome of each run. @intent 자동 정책 엔진의 실행 이력과 결과를 추적해 후속 판단 근거로 사용한다.

func (PostprocessRunLog) TableName

func (PostprocessRunLog) TableName() string

TableName pins PostprocessRunLog to the shared postprocess run log table name. @intent preserve schema compatibility for policy history queries and migrations.

type SchemaVersion

type SchemaVersion struct {
	Key       string `gorm:"primaryKey;size:64"`
	Version   int    `gorm:"not null"`
	UpdatedAt time.Time
}

SchemaVersion records the database schema level expected by the binary. @intent let runtime commands fail fast when explicit migrations were not run.

func (SchemaVersion) TableName

func (SchemaVersion) TableName() string

TableName pins SchemaVersion to the migration-managed schema version table. @intent keep runtime schema checks aligned with explicit migration bookkeeping.

type SearchDocument

type SearchDocument struct {
	ID        uint   `gorm:"primaryKey"`
	Namespace string `gorm:"size:256;not null;default:'default';index;uniqueIndex:idx_searchdoc_ns_node"`
	NodeID    uint   `gorm:"not null;uniqueIndex:idx_searchdoc_ns_node"`
	Content   string `gorm:"type:text;not null"`
	Language  string `gorm:"size:32;index"`
}

SearchDocument는 노드 검색용 색인 문서를 저장한다. @intent 전문 검색 백엔드가 사용할 노드별 검색 본문을 유지한다.

type TagKind

type TagKind string

TagKind는 DocTag의 종류를 나타낸다. @intent 구조화된 문서 태그의 의미 분류를 표준화한다.

const (
	TagParam      TagKind = "param"
	TagReturn     TagKind = "return"
	TagSee        TagKind = "see"
	TagIntent     TagKind = "intent"
	TagDomainRule TagKind = "domainRule"
	TagSideEffect TagKind = "sideEffect"
	TagMutates    TagKind = "mutates"
	TagRequires   TagKind = "requires"
	TagEnsures    TagKind = "ensures"
	TagIndex      TagKind = "index"
	TagThrows     TagKind = "throws"
	TagTypedef    TagKind = "typedef"
)

Jump to

Keyboard shortcuts

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