Enhanced godoc

This commit is contained in:
2025-12-28 11:42:05 +02:00
parent f98b278d72
commit d52b9cdc14
4 changed files with 88 additions and 48 deletions

View File

@@ -1,10 +1,12 @@
package models
// =============================================================================
// Summary/Compact Views - Lightweight views with essential fields
// =============================================================================
// Summary/Compact Views
//
// This file provides lightweight summary structures with essential fields
// and aggregated counts for quick database schema overviews without loading
// full object graphs.
// DatabaseSummary provides a compact overview of a database
// DatabaseSummary provides a compact overview of a database with aggregated statistics.
type DatabaseSummary struct {
Name string `json:"name" yaml:"name" xml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty" xml:"description,omitempty"`
@@ -15,7 +17,7 @@ type DatabaseSummary struct {
TotalColumns int `json:"total_columns" yaml:"total_columns" xml:"total_columns"`
}
// ToSummary converts a Database to a DatabaseSummary
// ToSummary converts a Database to a DatabaseSummary with calculated counts.
func (d *Database) ToSummary() *DatabaseSummary {
summary := &DatabaseSummary{
Name: d.Name,
@@ -36,7 +38,7 @@ func (d *Database) ToSummary() *DatabaseSummary {
return summary
}
// SchemaSummary provides a compact overview of a schema
// SchemaSummary provides a compact overview of a schema with aggregated statistics.
type SchemaSummary struct {
Name string `json:"name" yaml:"name" xml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty" xml:"description,omitempty"`
@@ -47,7 +49,7 @@ type SchemaSummary struct {
TotalConstraints int `json:"total_constraints" yaml:"total_constraints" xml:"total_constraints"`
}
// ToSummary converts a Schema to a SchemaSummary
// ToSummary converts a Schema to a SchemaSummary with calculated counts.
func (s *Schema) ToSummary() *SchemaSummary {
summary := &SchemaSummary{
Name: s.Name,
@@ -66,7 +68,7 @@ func (s *Schema) ToSummary() *SchemaSummary {
return summary
}
// TableSummary provides a compact overview of a table
// TableSummary provides a compact overview of a table with aggregated statistics.
type TableSummary struct {
Name string `json:"name" yaml:"name" xml:"name"`
Schema string `json:"schema" yaml:"schema" xml:"schema"`
@@ -79,7 +81,7 @@ type TableSummary struct {
ForeignKeyCount int `json:"foreign_key_count" yaml:"foreign_key_count" xml:"foreign_key_count"`
}
// ToSummary converts a Table to a TableSummary
// ToSummary converts a Table to a TableSummary with calculated counts.
func (t *Table) ToSummary() *TableSummary {
summary := &TableSummary{
Name: t.Name,