schema

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package schema defines entity and field metadata for AQL queries.

Index

Constants

View Source
const CustomFieldPrefix = "custom."

CustomFieldPrefix is the prefix for custom field names.

Variables

This section is empty.

Functions

func AllEntities

func AllEntities() map[ast.EntityType]*Entity

AllEntities returns all entity schemas.

func CustomFieldName

func CustomFieldName(name string) string

CustomFieldName extracts the custom field name without the prefix.

func IsCustomFieldName

func IsCustomFieldName(name string) bool

IsCustomFieldName returns true if the field name indicates a custom field.

Types

type Entity

type Entity struct {
	Name        ast.EntityType
	DisplayName string
	Fields      map[string]*Field
}

Entity represents an Aha entity type with its metadata.

func GetEntity

func GetEntity(entityType ast.EntityType) *Entity

GetEntity returns the entity schema for the given entity type.

func (*Entity) Field

func (e *Entity) Field(name string) *Field

Field returns the field definition for the given name, or nil if not found.

func (*Entity) HasField

func (e *Entity) HasField(name string) bool

HasField returns true if the entity has the given field.

type Field

type Field struct {
	// Name is the field name.
	Name string

	// Type is the field's data type.
	Type FieldType

	// Filterable indicates if the field can be used in WHERE clauses.
	Filterable bool

	// Sortable indicates if the field can be used in ORDER BY clauses.
	Sortable bool

	// APIParam is the Aha API parameter name for this field.
	// If empty, the field can only be filtered client-side.
	APIParam string

	// CustomField indicates if this is a custom field (prefixed with "custom.").
	CustomField bool
}

Field represents a field definition in an entity schema.

func (*Field) IsPushable

func (f *Field) IsPushable() bool

IsPushable returns true if filters on this field can be pushed to the Aha API.

type FieldType

type FieldType int

FieldType represents the data type of a field.

const (
	FieldTypeString FieldType = iota
	FieldTypeInt
	FieldTypeFloat
	FieldTypeBool
	FieldTypeDate
	FieldTypeDatetime
	FieldTypeStringArray
)

Field types.

func (FieldType) String

func (t FieldType) String() string

String returns the string representation of the field type.

Jump to

Keyboard shortcuts

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