models#

import "github.com/magnus-ffcg/go-dbt2lookml/pkg/models"

Package models defines data structures for dbt and LookML representations.

This package contains the domain models used throughout the application, including dbt artifacts (models, columns, metadata) and LookML structures (views, dimensions, measures, explores).

dbt Models:

  • DbtModel: Represents a dbt model with columns and metadata
  • DbtModelColumn: Column definition with data type and metadata
  • DbtCatalog: Parsed catalog.json structure
  • DbtManifest: Parsed manifest.json structure
  • DbtExposure: dbt exposure definitions

LookML Models:

  • LookMLView: Complete LookML view structure
  • LookMLDimension: Dimension field definition
  • LookMLDimensionGroup: Dimension group for dates/timestamps
  • LookMLMeasure: Measure field definition
  • LookMLExplore: Explore with joins

Metadata:

  • DbtMetaLooker: Custom LookML metadata from dbt meta tags
  • DbtMetaLookerDimension: Dimension-specific metadata
  • DbtMetaLookerMeasure: Measure-specific metadata

All LookML models include Validate() methods to ensure data integrity before generation.

Index#

Constants#

MaxNestedArrayDepth defines the maximum nesting level for array processing.

Nesting levels:

  • Level 1: items (0 dots in path)
  • Level 2: items.subitems (1 dot in path)
  • Level 3: items.subitems.details (2 dots in path)
  • Level 4+: Considered too deeply nested (3+ dots)

Arrays beyond Level 3 are typically too complex for efficient querying and can cause performance issues in most BI tools.

const MaxNestedArrayDepth = 3

type ColumnCategory#

ColumnCategory represents where a column should be placed.

type ColumnCategory int

const (
    // CategoryExcluded means the column should be excluded from all views
    CategoryExcluded ColumnCategory = iota
    // CategoryMainView means the column belongs in the main view
    CategoryMainView
    // CategoryNestedView means the column belongs in a nested view
    CategoryNestedView
)

type ColumnClassifier#

ColumnClassifier determines where each column should be placed based on business rules for BigQuery nested structures (ARRAY, STRUCT).

type ColumnClassifier struct {
    // contains filtered or unexported fields
}

func NewColumnClassifier#

func NewColumnClassifier(hierarchy *ColumnHierarchy, arrayColumns map[string]bool) *ColumnClassifier

NewColumnClassifier creates a classifier with the given hierarchy and array columns.

func (*ColumnClassifier) Classify#

func (c *ColumnClassifier) Classify(columnName string, column DbtModelColumn) ColumnCategory

Classify determines the category for a given column.

func (*ColumnClassifier) GetArrayParent#

func (c *ColumnClassifier) GetArrayParent(columnName string) string

GetArrayParent returns the array parent for a column, if any.

func (*ColumnClassifier) HasChildren#

func (c *ColumnClassifier) HasChildren(columnName string) bool

HasChildren checks if a column has child columns.

func (*ColumnClassifier) IsNestedArray#

func (c *ColumnClassifier) IsNestedArray(columnName string) bool

IsNestedArray checks if an array column is nested under another array.

type ColumnCollections#

ColumnCollections organizes model columns by their intended use

type ColumnCollections struct {
    MainViewColumns   map[string]DbtModelColumn            // Columns for the main view
    NestedViewColumns map[string]map[string]DbtModelColumn // array_name -> columns for nested views
    ExcludedColumns   map[string]DbtModelColumn            // Columns excluded from all views
}

func NewColumnCollections#

func NewColumnCollections(model *DbtModel, arrayModels []string) *ColumnCollections

FromModel creates column collections from a dbt model with optimized processing

func NewColumnCollectionsV2#

func NewColumnCollectionsV2(model *DbtModel, arrayModels []string) *ColumnCollections

NewColumnCollectionsV2 creates column collections using the refactored services. This is a cleaner implementation that delegates to specialized services.

func (*ColumnCollections) GetArrayModels#

func (cc *ColumnCollections) GetArrayModels() []string

GetArrayModels extracts all array models from the column collections

type ColumnHierarchy#

ColumnHierarchy represents the parent-child relationships between columns. It’s used to understand nested STRUCT and ARRAY structures in BigQuery.

type ColumnHierarchy struct {
    // contains filtered or unexported fields
}

func NewColumnHierarchy#

func NewColumnHierarchy(columns map[string]DbtModelColumn) *ColumnHierarchy

NewColumnHierarchy builds a hierarchy from a flat map of columns. It analyzes dot-separated paths to build parent-child relationships.

func (*ColumnHierarchy) All#

func (h *ColumnHierarchy) All() map[string]*HierarchyInfo

All returns the entire hierarchy map.

func (*ColumnHierarchy) Get#

func (h *ColumnHierarchy) Get(path string) *HierarchyInfo

Get returns the hierarchy info for a given column path.

func (*ColumnHierarchy) GetChildren#

func (h *ColumnHierarchy) GetChildren(path string) []string

GetChildren returns all child paths for a given column.

func (*ColumnHierarchy) HasChildren#

func (h *ColumnHierarchy) HasChildren(path string) bool

HasChildren checks if a column has any child columns.

func (*ColumnHierarchy) IsArray#

func (h *ColumnHierarchy) IsArray(path string) bool

IsArray checks if a column is an ARRAY type.

type DbtBaseModel#

DbtBaseModel represents the base model for dbt objects

type DbtBaseModel struct{}

type DbtCatalog#

DbtCatalog represents a dbt catalog

type DbtCatalog struct {
    Nodes map[string]DbtCatalogNode `json:"nodes" yaml:"nodes"`
}

type DbtCatalogNode#

DbtCatalogNode represents a dbt catalog node

type DbtCatalogNode struct {
    Metadata DbtCatalogNodeMetadata          `json:"metadata" yaml:"metadata"`
    Columns  map[string]DbtCatalogNodeColumn `json:"columns" yaml:"columns"`
}

func (*DbtCatalogNode) NormalizeColumnNames#

func (n *DbtCatalogNode) NormalizeColumnNames()

NormalizeColumnNames converts all column names to lowercase for case-insensitive matching but preserves the original name for LookML generation

type DbtCatalogNodeColumn#

DbtCatalogNodeColumn represents a column in a dbt catalog node

type DbtCatalogNodeColumn struct {
    Type         string                `json:"type" yaml:"type"`
    DataType     string                `json:"data_type" yaml:"data_type"`
    InnerTypes   []string              `json:"inner_types" yaml:"inner_types"`
    Comment      *string               `json:"comment,omitempty" yaml:"comment,omitempty"`
    Index        int                   `json:"index" yaml:"index"`
    Name         string                `json:"name" yaml:"name"`
    OriginalName string                `json:"original_name" yaml:"original_name"`
    Parent       *DbtCatalogNodeColumn `json:"parent,omitempty" yaml:"parent,omitempty"`
}

func (*DbtCatalogNodeColumn) ProcessColumnType#

func (c *DbtCatalogNodeColumn) ProcessColumnType()

ProcessColumnType processes the column type and extracts data type and inner types

type DbtCatalogNodeMetadata#

DbtCatalogNodeMetadata represents metadata about a dbt catalog node

type DbtCatalogNodeMetadata struct {
    Type    string  `json:"type" yaml:"type"`
    Schema  string  `json:"schema" yaml:"schema"`
    Name    string  `json:"name" yaml:"name"`
    Comment *string `json:"comment,omitempty" yaml:"comment,omitempty"`
    Owner   *string `json:"owner,omitempty" yaml:"owner,omitempty"`
}

type DbtDependsOn#

DbtDependsOn represents dependencies between dbt objects

type DbtDependsOn struct {
    Macros []string `json:"macros" yaml:"macros"`
    Nodes  []string `json:"nodes" yaml:"nodes"`
}

type DbtExposure#

DbtExposure represents a dbt exposure

type DbtExposure struct {
    DbtNode
    Description *string          `json:"description,omitempty" yaml:"description,omitempty"`
    URL         *string          `json:"url,omitempty" yaml:"url,omitempty"`
    Refs        []DbtExposureRef `json:"refs" yaml:"refs"`
    Tags        []string         `json:"tags" yaml:"tags"`
    DependsOn   DbtDependsOn     `json:"depends_on" yaml:"depends_on"`
}

type DbtExposureRef#

DbtExposureRef represents a reference in a dbt exposure

type DbtExposureRef struct {
    Name    string      `json:"name" yaml:"name"`
    Package *string     `json:"package,omitempty" yaml:"package,omitempty"`
    Version interface{} `json:"version,omitempty" yaml:"version,omitempty"` // Can be string or int
}

type DbtManifest#

DbtManifest represents a dbt manifest

type DbtManifest struct {
    Nodes     map[string]interface{} `json:"nodes" yaml:"nodes"` // Can be DbtModel or DbtNode
    Metadata  DbtManifestMetadata    `json:"metadata" yaml:"metadata"`
    Exposures map[string]DbtExposure `json:"exposures" yaml:"exposures"`
}

type DbtManifestMetadata#

DbtManifestMetadata represents metadata about a dbt manifest

type DbtManifestMetadata struct {
    AdapterType string `json:"adapter_type" yaml:"adapter_type"`
}

func (*DbtManifestMetadata) ValidateAdapter#

func (m *DbtManifestMetadata) ValidateAdapter() error

ValidateAdapter validates that the adapter type is supported

type DbtMetaLooker#

DbtMetaLooker represents Looker metadata for a model

type DbtMetaLooker struct {
    View      *DbtMetaLookerBase      `json:"view,omitempty" yaml:"view,omitempty"`
    Dimension *DbtMetaLookerDimension `json:"dimension,omitempty" yaml:"dimension,omitempty"`
    Measures  []DbtMetaLookerMeasure  `json:"measures,omitempty" yaml:"measures,omitempty"`
    Joins     []DbtMetaLookerJoin     `json:"joins,omitempty" yaml:"joins,omitempty"`
}

type DbtMetaLookerBase#

DbtMetaLookerBase represents the base class for Looker metadata

type DbtMetaLookerBase struct {
    Label       *string `json:"label,omitempty" yaml:"label,omitempty"`
    Description *string `json:"description,omitempty" yaml:"description,omitempty"`
    Hidden      *bool   `json:"hidden,omitempty" yaml:"hidden,omitempty"`
}

type DbtMetaLookerDimension#

DbtMetaLookerDimension represents Looker-specific metadata for a dimension

type DbtMetaLookerDimension struct {
    DbtMetaLookerBase
    ConvertTZ       *bool                        `json:"convert_tz,omitempty" yaml:"convert_tz,omitempty"`
    GroupLabel      *string                      `json:"group_label,omitempty" yaml:"group_label,omitempty"`
    ValueFormatName *enums.LookerValueFormatName `json:"value_format_name,omitempty" yaml:"value_format_name,omitempty"`
    Timeframes      []enums.LookerTimeFrame      `json:"timeframes,omitempty" yaml:"timeframes,omitempty"`
    CanFilter       interface{}                  `json:"can_filter,omitempty" yaml:"can_filter,omitempty"` // Can be bool or string
}

type DbtMetaLookerJoin#

DbtMetaLookerJoin represents Looker-specific metadata for joins

type DbtMetaLookerJoin struct {
    JoinModel    *string                       `json:"join_model,omitempty" yaml:"join_model,omitempty"`
    SQLON        *string                       `json:"sql_on,omitempty" yaml:"sql_on,omitempty"`
    Type         *enums.LookerJoinType         `json:"type,omitempty" yaml:"type,omitempty"`
    Relationship *enums.LookerRelationshipType `json:"relationship,omitempty" yaml:"relationship,omitempty"`
}

type DbtMetaLookerMeasure#

DbtMetaLookerMeasure represents Looker metadata for a measure

type DbtMetaLookerMeasure struct {
    DbtMetaLookerBase
    // Required fields
    Type enums.LookerMeasureType `json:"type" yaml:"type"`

    // Common optional fields
    Name            *string                      `json:"name,omitempty" yaml:"name,omitempty"`
    GroupLabel      *string                      `json:"group_label,omitempty" yaml:"group_label,omitempty"`
    ValueFormatName *enums.LookerValueFormatName `json:"value_format_name,omitempty" yaml:"value_format_name,omitempty"`
    Filters         []DbtMetaLookerMeasureFilter `json:"filters,omitempty" yaml:"filters,omitempty"`

    // Fields specific to certain measure types
    Approximate          *bool   `json:"approximate,omitempty" yaml:"approximate,omitempty"`                     // For count_distinct
    ApproximateThreshold *int    `json:"approximate_threshold,omitempty" yaml:"approximate_threshold,omitempty"` // For count_distinct
    Precision            *int    `json:"precision,omitempty" yaml:"precision,omitempty"`                         // For average, sum
    SQLDistinctKey       *string `json:"sql_distinct_key,omitempty" yaml:"sql_distinct_key,omitempty"`           // For count_distinct
    Percentile           *int    `json:"percentile,omitempty" yaml:"percentile,omitempty"`                       // For percentile measures
}

func (*DbtMetaLookerMeasure) ValidateMeasureAttributes#

func (m *DbtMetaLookerMeasure) ValidateMeasureAttributes() error

ValidateMeasureAttributes validates that measure attributes are compatible with the measure type

type DbtMetaLookerMeasureFilter#

DbtMetaLookerMeasureFilter represents a filter for Looker measures

type DbtMetaLookerMeasureFilter struct {
    FilterDimension  string `json:"filter_dimension" yaml:"filter_dimension"`
    FilterExpression string `json:"filter_expression" yaml:"filter_expression"`
}

type DbtModel#

DbtModel represents a dbt model

type DbtModel struct {
    DbtNode
    ResourceType string                    `json:"resource_type" yaml:"resource_type"`
    RelationName string                    `json:"relation_name" yaml:"relation_name"`
    Schema       string                    `json:"schema" yaml:"schema"`
    Description  string                    `json:"description" yaml:"description"`
    Columns      map[string]DbtModelColumn `json:"columns" yaml:"columns"`
    Tags         []string                  `json:"tags" yaml:"tags"`
    Meta         *DbtModelMeta             `json:"meta,omitempty" yaml:"meta,omitempty"`
    Path         string                    `json:"path" yaml:"path"`
}

func (*DbtModel) NormalizeColumnNames#

func (m *DbtModel) NormalizeColumnNames()

NormalizeColumnNames converts all column names to lowercase for case-insensitive matching

type DbtModelColumn#

DbtModelColumn represents a column in a dbt model

type DbtModelColumn struct {
    Name           string              `json:"name" yaml:"name"`
    Description    *string             `json:"description,omitempty" yaml:"description,omitempty"`
    LookMLLongName *string             `json:"lookml_long_name,omitempty" yaml:"lookml_long_name,omitempty"`
    LookMLName     *string             `json:"lookml_name,omitempty" yaml:"lookml_name,omitempty"`
    OriginalName   *string             `json:"original_name,omitempty" yaml:"original_name,omitempty"`
    DataType       *string             `json:"data_type,omitempty" yaml:"data_type,omitempty"`
    InnerTypes     []string            `json:"inner_types" yaml:"inner_types"`
    Meta           *DbtModelColumnMeta `json:"meta,omitempty" yaml:"meta,omitempty"`
    Nested         bool                `json:"nested" yaml:"nested"`
    IsPrimaryKey   bool                `json:"is_primary_key" yaml:"is_primary_key"`
}

func (*DbtModelColumn) GetDataTypeUpper#

func (c *DbtModelColumn) GetDataTypeUpper() string

GetDataTypeUpper returns the uppercase data type string, or empty string if nil

func (*DbtModelColumn) IsArrayColumn#

func (c *DbtModelColumn) IsArrayColumn() bool

IsArrayColumn returns true if the column is an ARRAY type

func (*DbtModelColumn) IsDateTimeColumn#

func (c *DbtModelColumn) IsDateTimeColumn() bool

IsDateTimeColumn returns true if the column is a date/time type (DATE, DATETIME, TIMESTAMP)

func (*DbtModelColumn) IsSimpleArrayColumn#

func (c *DbtModelColumn) IsSimpleArrayColumn() bool

IsSimpleArrayColumn returns true if the column is a simple ARRAY without STRUCT (e.g., ARRAY<STRING>, ARRAY<INT64>)

func (*DbtModelColumn) IsStructColumn#

func (c *DbtModelColumn) IsStructColumn() bool

IsStructColumn returns true if the column is a STRUCT type

func (*DbtModelColumn) ProcessColumn#

func (c *DbtModelColumn) ProcessColumn()

ProcessColumn processes the column and sets derived fields

type DbtModelColumnMeta#

DbtModelColumnMeta represents metadata about a column in a dbt model

type DbtModelColumnMeta struct {
    Looker *DbtMetaLooker `json:"looker,omitempty" yaml:"looker,omitempty"`
}

type DbtModelMeta#

DbtModelMeta represents metadata about a dbt model

type DbtModelMeta struct {
    Looker *DbtMetaLooker `json:"looker,omitempty" yaml:"looker,omitempty"`
}

type DbtNode#

DbtNode represents a dbt node, extensible to models, seeds, etc.

type DbtNode struct {
    Name         string                `json:"name" yaml:"name"`
    UniqueID     string                `json:"unique_id" yaml:"unique_id"`
    ResourceType enums.DbtResourceType `json:"resource_type" yaml:"resource_type"`
}

type DimensionConflictResolver#

DimensionConflictResolver handles conflicts between dimensions and dimension groups.

When a dimension has the same name as a dimension group or one of its timeframe variations, it creates a naming conflict in LookML. This resolver detects such conflicts and renames the conflicting dimensions by adding a “_conflict” suffix and marking them as hidden.

Example conflict:

  • Dimension: “created_date” (from STRUCT field or nested column)
  • Dimension Group: “created” with timeframe “date” → generates “created_date”
  • Resolution: Rename dimension to “created_date_conflict” and hide it
type DimensionConflictResolver struct {
    // contains filtered or unexported fields
}

func NewDimensionConflictResolver#

func NewDimensionConflictResolver(cfg *config.Config) *DimensionConflictResolver

NewDimensionConflictResolver creates a new resolver with default settings.

func NewDimensionConflictResolverWithOptions#

func NewDimensionConflictResolverWithOptions(suffix string, hideConflicts bool, cfg *config.Config) *DimensionConflictResolver

NewDimensionConflictResolverWithOptions creates a resolver with custom settings.

func (*DimensionConflictResolver) GetConflictingDimensions#

func (r *DimensionConflictResolver) GetConflictingDimensions(dimensions []LookMLDimension, dimensionGroups []LookMLDimensionGroup) []string

GetConflictingDimensions returns a list of dimension names that conflict with dimension groups. Useful for debugging or reporting.

func (*DimensionConflictResolver) GetReservedNames#

func (r *DimensionConflictResolver) GetReservedNames(dimensionGroups []LookMLDimensionGroup) []string

GetReservedNames returns all names that are reserved by dimension groups. Useful for validation or documentation.

func (*DimensionConflictResolver) Resolve#

func (r *DimensionConflictResolver) Resolve(dimensions []LookMLDimension, dimensionGroups []LookMLDimensionGroup, modelName string) []LookMLDimension

Resolve detects and resolves naming conflicts between dimensions and dimension groups. Returns a new slice with conflicting dimensions renamed and optionally hidden.

type HierarchyInfo#

HierarchyInfo contains information about a column’s position in the hierarchy.

type HierarchyInfo struct {
    Children []string        // Child column paths
    IsArray  bool            // Whether this column is an ARRAY type
    Column   *DbtModelColumn // Reference to the actual column
}

type LookMLDimension#

LookMLDimension represents a dimension in LookML

type LookMLDimension struct {
    Name            string                       `json:"name" yaml:"name"`
    Type            string                       `json:"type" yaml:"type"`
    SQL             string                       `json:"sql" yaml:"sql"`
    Label           *string                      `json:"label,omitempty" yaml:"label,omitempty"`
    Description     *string                      `json:"description,omitempty" yaml:"description,omitempty"`
    Hidden          *bool                        `json:"hidden,omitempty" yaml:"hidden,omitempty"`
    GroupLabel      *string                      `json:"group_label,omitempty" yaml:"group_label,omitempty"`
    GroupItemLabel  *string                      `json:"group_item_label,omitempty" yaml:"group_item_label,omitempty"`
    ValueFormatName *enums.LookerValueFormatName `json:"value_format_name,omitempty" yaml:"value_format_name,omitempty"`
    CanFilter       *bool                        `json:"can_filter,omitempty" yaml:"can_filter,omitempty"`
    ConvertTZ       *bool                        `json:"convert_tz,omitempty" yaml:"convert_tz,omitempty"`
}

func (*LookMLDimension) Validate#

func (d *LookMLDimension) Validate() error

Validate checks if the dimension has all required fields

type LookMLDimensionGroup#

LookMLDimensionGroup represents a dimension group in LookML

type LookMLDimensionGroup struct {
    Name        string                  `json:"name" yaml:"name"`
    Type        string                  `json:"type" yaml:"type"`
    SQL         string                  `json:"sql" yaml:"sql"`
    Label       *string                 `json:"label,omitempty" yaml:"label,omitempty"`
    Description *string                 `json:"description,omitempty" yaml:"description,omitempty"`
    Hidden      *bool                   `json:"hidden,omitempty" yaml:"hidden,omitempty"`
    GroupLabel  *string                 `json:"group_label,omitempty" yaml:"group_label,omitempty"`
    Timeframes  []enums.LookerTimeFrame `json:"timeframes,omitempty" yaml:"timeframes,omitempty"`
    ConvertTZ   *bool                   `json:"convert_tz,omitempty" yaml:"convert_tz,omitempty"`
}

type LookMLExplore#

LookMLExplore represents an explore in LookML

type LookMLExplore struct {
    Name        string       `json:"name" yaml:"name"`
    ViewName    string       `json:"view_name" yaml:"view_name"`
    Label       *string      `json:"label,omitempty" yaml:"label,omitempty"`
    Description *string      `json:"description,omitempty" yaml:"description,omitempty"`
    Hidden      *bool        `json:"hidden,omitempty" yaml:"hidden,omitempty"`
    Joins       []LookMLJoin `json:"joins,omitempty" yaml:"joins,omitempty"`
}

type LookMLJoin#

LookMLJoin represents a join in LookML explores

type LookMLJoin struct {
    Name         string                        `json:"name" yaml:"name"`
    ViewLabel    *string                       `json:"view_label,omitempty" yaml:"view_label,omitempty"`
    SQL          *string                       `json:"sql,omitempty" yaml:"sql,omitempty"`
    Type         *enums.LookerJoinType         `json:"type,omitempty" yaml:"type,omitempty"`
    Relationship *enums.LookerRelationshipType `json:"relationship,omitempty" yaml:"relationship,omitempty"`
}

type LookMLMeasure#

LookMLMeasure represents a measure in LookML

type LookMLMeasure struct {
    Name                 string                       `json:"name" yaml:"name"`
    Type                 enums.LookerMeasureType      `json:"type" yaml:"type"`
    SQL                  *string                      `json:"sql,omitempty" yaml:"sql,omitempty"`
    Label                *string                      `json:"label,omitempty" yaml:"label,omitempty"`
    Description          *string                      `json:"description,omitempty" yaml:"description,omitempty"`
    Hidden               *bool                        `json:"hidden,omitempty" yaml:"hidden,omitempty"`
    GroupLabel           *string                      `json:"group_label,omitempty" yaml:"group_label,omitempty"`
    ValueFormatName      *enums.LookerValueFormatName `json:"value_format_name,omitempty" yaml:"value_format_name,omitempty"`
    Approximate          *bool                        `json:"approximate,omitempty" yaml:"approximate,omitempty"`
    ApproximateThreshold *int                         `json:"approximate_threshold,omitempty" yaml:"approximate_threshold,omitempty"`
    Precision            *int                         `json:"precision,omitempty" yaml:"precision,omitempty"`
    SQLDistinctKey       *string                      `json:"sql_distinct_key,omitempty" yaml:"sql_distinct_key,omitempty"`
    Percentile           *int                         `json:"percentile,omitempty" yaml:"percentile,omitempty"`
    Filters              []DbtMetaLookerMeasureFilter `json:"filters,omitempty" yaml:"filters,omitempty"`
}

func (*LookMLMeasure) Validate#

func (m *LookMLMeasure) Validate() error

Validate checks if the measure has all required fields and valid attributes

type LookMLView#

LookMLView represents a view in LookML

type LookMLView struct {
    Name            string                 `json:"name" yaml:"name"`
    SQLTableName    string                 `json:"sql_table_name" yaml:"sql_table_name"`
    Label           *string                `json:"label,omitempty" yaml:"label,omitempty"`
    Description     *string                `json:"description,omitempty" yaml:"description,omitempty"`
    Hidden          *bool                  `json:"hidden,omitempty" yaml:"hidden,omitempty"`
    Dimensions      []LookMLDimension      `json:"dimensions,omitempty" yaml:"dimensions,omitempty"`
    DimensionGroups []LookMLDimensionGroup `json:"dimension_groups,omitempty" yaml:"dimension_groups,omitempty"`
    Measures        []LookMLMeasure        `json:"measures,omitempty" yaml:"measures,omitempty"`
}

func (*LookMLView) Validate#

func (v *LookMLView) Validate() error

Validate checks if the view has all required fields and validates child elements

type LookViewFile#

LookViewFile represents a file in a looker view directory

type LookViewFile struct {
    Filename string `json:"filename" yaml:"filename"`
    Contents string `json:"contents" yaml:"contents"`
    Schema   string `json:"schema" yaml:"schema"`
}

type NestedArrayRules#

NestedArrayRules encapsulates business rules for nested array processing. It determines which nested arrays should be processed based on their depth in the column hierarchy.

type NestedArrayRules struct {
    // contains filtered or unexported fields
}

func NewNestedArrayRules#

func NewNestedArrayRules() *NestedArrayRules

NewNestedArrayRules creates a new NestedArrayRules instance with default settings.

func NewNestedArrayRulesWithDepth#

func NewNestedArrayRulesWithDepth(maxDepth int) *NestedArrayRules

NewNestedArrayRulesWithDepth creates a new NestedArrayRules instance with custom max depth.

func (*NestedArrayRules) GetArrayDepth#

func (r *NestedArrayRules) GetArrayDepth(arrayPath string) int

GetArrayDepth returns the nesting level of an array based on its path. The depth is calculated by counting dots in the path and adding 1.

Examples:

  • “items” → 1 (0 dots)
  • “items.subitems” → 2 (1 dot)
  • “items.subitems.details” → 3 (2 dots)
  • “items.subitems.details.meta” → 4 (3 dots)

func (*NestedArrayRules) GetMaxDepth#

func (r *NestedArrayRules) GetMaxDepth() int

GetMaxDepth returns the maximum allowed nesting depth.

func (*NestedArrayRules) IsValidArrayPath#

func (r *NestedArrayRules) IsValidArrayPath(arrayPath string) bool

IsValidArrayPath checks if the array path is valid (non-empty and not too deep).

func (*NestedArrayRules) ShouldProcessArray#

func (r *NestedArrayRules) ShouldProcessArray(arrayPath string) bool

ShouldProcessArray determines if an array at the given path should be processed based on its nesting depth.

Examples:

  • “items” (level 1) → true
  • “items.subitems” (level 2) → true
  • “items.subitems.details” (level 3) → true
  • “items.subitems.details.meta” (level 4) → false
  • "" (empty) → false

Generated by gomarkdoc