data

package
v0.0.0-...-827bfe2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package data provides data binding types for go-fastreport. It is the Go equivalent of FastReport.Data namespace.

Package data is part of the go-fastreport library, a pure Go port of FastReport .NET.

Index

Constants

View Source
const (
	// SysVarPage is the current page number ("Page" — C# PageVariable.Name).
	SysVarPage = "Page"
	// SysVarPageNumber is a Go-idiomatic alias for SysVarPage ("PageNumber").
	SysVarPageNumber = "PageNumber"
	// SysVarTotalPages is the total number of pages ("TotalPages" — C# TotalPagesVariable.Name).
	SysVarTotalPages = "TotalPages"
	// SysVarPageCount is an alternative alias for TotalPages kept for backward compatibility.
	SysVarPageCount = "PageCount"
	// SysVarPageN is the "Page N" string ("PageN" — C# PageNVariable.Name).
	SysVarPageN = "PageN"
	// SysVarPageNofM is the "Page N of M" string ("PageNofM" — C# PageNofMVariable.Name).
	SysVarPageNofM = "PageNofM"
	// SysVarDate is the report-run date ("Date" — C# DateVariable.Name).
	SysVarDate = "Date"
	// SysVarTime is the report-run time ("Time" — not directly in C# but
	// used by the Go port for the time component of Date).
	SysVarTime = "Time"
	// SysVarRow is the in-group data row counter ("Row#" — C# RowVariable.Name).
	SysVarRow = "Row#"
	// SysVarAbsRow is the absolute data row counter ("AbsRow#" — C# AbsRowVariable.Name).
	SysVarAbsRow = "AbsRow#"
	// SysVarPageMacro is the page-number print macro ("Page#" — C# PageMacroVariable.Name).
	SysVarPageMacro = "Page#"
	// SysVarTotalPagesMacro is the total-pages print macro ("TotalPages#").
	SysVarTotalPagesMacro = "TotalPages#"
	// SysVarCopyNameMacro is the copy-name print macro ("CopyName#").
	SysVarCopyNameMacro = "CopyName#"
	// SysVarHierarchyLevel is the hierarchy nesting depth ("HierarchyLevel").
	SysVarHierarchyLevel = "HierarchyLevel"
	// SysVarHierarchyRow is the dot-separated hierarchy row identifier ("HierarchyRow#").
	SysVarHierarchyRow = "HierarchyRow#"
)

System variable name constants mirror FastReport.Data.SystemVariables (SystemVariables.cs). Each constant holds the exact Name string that the C# variable class uses.

Variables

View Source
var ErrEOF = fmt.Errorf("data source: no more rows (EOF)")

ErrEOF is returned by Next() when the data source has no more rows.

View Source
var ErrNotInitialized = fmt.Errorf("data source: not initialized")

ErrNotInitialized is returned when accessing a datasource that hasn't been Init()-ed.

Functions

func AssignValues

func AssignValues(dst []*Parameter, src []*Parameter)

AssignValues copies parameter values from src parameters into dst parameters by matching full dot-separated names. Mirrors C# ParameterCollection.AssignValues.

func ColumnFormatString

func ColumnFormatString(f ColumnFormat) string

ColumnFormatString returns the FRX string representation of a ColumnFormat.

func GetColumnType

func GetColumnType(dict DictionaryLookup, complexName string) string

GetColumnType returns the datatype string for a resolved column, or empty.

func GetTotal

func GetTotal(dict DictionaryLookup, name string) any

GetTotal returns the value of the named total, or nil when not found.

func IsSimpleColumn

func IsSimpleColumn(dict DictionaryLookup, complexName string) bool

IsSimpleColumn reports whether the reference is a direct datasource column without relation traversal.

func IsValidColumn

func IsValidColumn(dict DictionaryLookup, complexName string) bool

IsValidColumn returns true when the complex column name resolves successfully.

func IsValidParameter

func IsValidParameter(dict DictionaryLookup, complexName string) bool

IsValidParameter returns true when the complex parameter name resolves to an existing user parameter or system variable.

func IsValidTotal

func IsValidTotal(dict DictionaryLookup, name string) bool

IsValidTotal returns true when a total with the given name exists.

Types

type AdditionalFilterPredicate

type AdditionalFilterPredicate func(value any) bool

AdditionalFilterPredicate is a function that returns true if the row value passes the filter for a specific column. Mirrors C# DataSourceFilter.ValueMatch().

type AfterDatabaseLoginEventArgs

type AfterDatabaseLoginEventArgs struct {
	// DB is the opened *sql.DB. The callback may inspect or configure it.
	DB *sql.DB
}

AfterDatabaseLoginEventArgs carries the open *sql.DB passed to the OnAfterDatabaseLogin callback after the connection has been established. C# ref: FastReport.AfterDatabaseLoginEventArgs (ReportEventArgs.cs). / ReportSettings.OnAfterDatabaseLogin → fires AfterDatabaseLogin event.

type AggregateTotal

type AggregateTotal struct {
	// Name is the total's unique identifier (used in expressions like [GrandTotal]).
	Name string
	// TotalType is the aggregate function.
	TotalType TotalType
	// Expression is the value expression evaluated per row (empty for Count).
	Expression string
	// EvaluateCondition is an optional filter expression; empty means always evaluate.
	EvaluateCondition string
	// IncludeInvisibleRows includes rows whose band is hidden.
	IncludeInvisibleRows bool
	// ResetAfterPrint resets the total after it is printed.
	ResetAfterPrint bool
	// ResetOnReprint controls whether the total resets when a band is reprinted
	// (e.g. RepeatOnEveryPage). C# default is true.
	ResetOnReprint bool
	// Evaluator is the name of the DataBand that drives this total.
	Evaluator string
	// PrintOn is the name of the band where the total is printed/reset.
	PrintOn string
	// contains filtered or unexported fields
}

AggregateTotal is a richer Total that tracks aggregate state. It is the Go equivalent of FastReport.Data.Total.

The simple Total struct in helper.go acts as a name/value pair; this type performs the actual accumulation used by the engine.

func NewAggregateTotal

func NewAggregateTotal(name string) *AggregateTotal

NewAggregateTotal creates an AggregateTotal with defaults (TotalTypeSum, ResetOnReprint=true matching C# default).

func (*AggregateTotal) Add

func (t *AggregateTotal) Add(value any) error

Add accumulates a value into the aggregate. value must be convertible to float64 for numeric aggregates.

func (*AggregateTotal) Clone

func (t *AggregateTotal) Clone() *AggregateTotal

Clone creates a copy of the AggregateTotal with the same configuration but fresh (zero) accumulator state. The keep-together snapshot fields are also reset.

func (*AggregateTotal) EndKeep

func (t *AggregateTotal) EndKeep()

EndKeep restores the accumulator state from the snapshot taken by StartKeep.

func (*AggregateTotal) Reset

func (t *AggregateTotal) Reset()

Reset clears the accumulated state.

func (*AggregateTotal) StartKeep

func (t *AggregateTotal) StartKeep()

StartKeep snapshots the current accumulator state into internal keep* fields. This is used by the engine's keep-together logic so the total can be rolled back if the kept block needs to move to a new page.

func (*AggregateTotal) Value

func (t *AggregateTotal) Value() any

Value returns the computed aggregate result.

type BaseDataSource

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

BaseDataSource provides a reusable implementation of the DataSource interface backed by an in-memory slice of row maps. Concrete data sources can embed it and override GetValue to supply their own row storage.

func NewBaseDataSource

func NewBaseDataSource(name string) *BaseDataSource

NewBaseDataSource creates a BaseDataSource with the given name.

func (*BaseDataSource) AddColumn

func (ds *BaseDataSource) AddColumn(col Column)

AddColumn adds a column descriptor.

func (*BaseDataSource) AddRow

func (ds *BaseDataSource) AddRow(row map[string]any)

AddRow appends a row to the internal row store.

func (*BaseDataSource) Alias

func (ds *BaseDataSource) Alias() string

Alias returns the display alias.

func (*BaseDataSource) ApplyAdditionalFilter

func (ds *BaseDataSource) ApplyAdditionalFilter()

ApplyAdditionalFilter removes any rows that fail the additional filter predicates. Mirrors C# DataSourceBase.ApplyAdditionalFilter() (DataSourceBase.cs:325-341). Call after Init() when additional column filters are needed.

func (*BaseDataSource) BOF

func (ds *BaseDataSource) BOF() bool

BOF returns true when the cursor is before the first row (not yet positioned). Mirrors C# DataSourceBase.BOF property (DataSourceBase.cs): CurrentRowNo < 0.

func (*BaseDataSource) ClearAdditionalFilter

func (ds *BaseDataSource) ClearAdditionalFilter()

ClearAdditionalFilter removes all additional filter predicates. Mirrors C# DataSourceBase.ClearData() → additionalFilter.Clear() (DataSourceBase.cs:754).

func (*BaseDataSource) Close

func (ds *BaseDataSource) Close() error

Close is a no-op for in-memory data sources.

func (*BaseDataSource) Columns

func (ds *BaseDataSource) Columns() []Column

Columns returns the column descriptors.

func (*BaseDataSource) CurrentRowNo

func (ds *BaseDataSource) CurrentRowNo() int

CurrentRowNo returns the 0-based current row index, or -1 if not positioned.

func (*BaseDataSource) EOF

func (ds *BaseDataSource) EOF() bool

EOF returns true when the cursor is past the last row.

func (*BaseDataSource) EnsureInit

func (ds *BaseDataSource) EnsureInit() error

EnsureInit initialises the data source if it has not been initialised yet. Mirrors C# DataSourceBase.EnsureInit() lazy-init pattern.

func (*BaseDataSource) First

func (ds *BaseDataSource) First() error

First positions at the first row.

func (*BaseDataSource) GetDisplayName

func (ds *BaseDataSource) GetDisplayName() string

GetDisplayName returns the human-readable display name. Returns Alias if it is non-empty, otherwise returns Name. Mirrors C# DataComponentBase.GetDisplayName() behaviour.

func (*BaseDataSource) GetValue

func (ds *BaseDataSource) GetValue(column string) (any, error)

GetValue returns the value of the named column in the current row.

func (*BaseDataSource) HasMoreRows

func (ds *BaseDataSource) HasMoreRows() bool

HasMoreRows returns true when the cursor is positioned at a valid row and there are more rows to consume (CurrentRowNo < RowCount). Mirrors C# DataSourceBase.HasMoreRows property (DataSourceBase.cs lines 90-93): CurrentRowNo < RowCount.

func (*BaseDataSource) Init

func (ds *BaseDataSource) Init() error

Init marks the data source as initialized and resets the position.

func (*BaseDataSource) Name

func (ds *BaseDataSource) Name() string

Name returns the data source name.

func (*BaseDataSource) Next

func (ds *BaseDataSource) Next() error

Next advances to the next row.

func (*BaseDataSource) Prior

func (ds *BaseDataSource) Prior()

Prior moves the cursor one row backwards. Mirrors C# DataSourceBase.Prior() (DataSourceBase.cs:724): CurrentRowNo--. No lower-bound check — callers must ensure position validity.

func (*BaseDataSource) RowCount

func (ds *BaseDataSource) RowCount() int

RowCount returns the number of rows.

func (*BaseDataSource) SetAdditionalFilter

func (ds *BaseDataSource) SetAdditionalFilter(column string, pred AdditionalFilterPredicate)

SetAdditionalFilter adds or replaces a column-level filter predicate. When rows are filtered (ApplyAdditionalFilter), only rows where pred returns true for the named column's value are kept. Mirrors C# DataSourceBase.AdditionalFilter Hashtable (DataSourceBase.cs:249-251).

func (*BaseDataSource) SetAlias

func (ds *BaseDataSource) SetAlias(a string)

SetAlias sets the display alias.

func (*BaseDataSource) SetCurrentRowNo

func (ds *BaseDataSource) SetCurrentRowNo(n int)

SetCurrentRowNo directly positions the cursor to the given 0-based row index. Mirrors C# DataSourceBase.CurrentRowNo setter used in ReportEngine.Groups.cs line 226.

func (*BaseDataSource) SetName

func (ds *BaseDataSource) SetName(n string)

SetName sets the data source name. When alias was previously equal to name (case-insensitively) or empty, it is kept in sync with the new name. Mirrors C# DataComponentBase.SetName alias-sync behavior.

func (*BaseDataSource) SortRows

func (ds *BaseDataSource) SortRows(specs []SortSpec)

SortRows reorders the internal rows slice according to specs. Only string, int64, float64, and bool column values are compared; other types fall back to fmt.Sprintf comparison.

type BusinessObjectConverter

type BusinessObjectConverter struct {
	// MaxNestingLevel is the maximum recursion depth for schema generation.
	// Defaults to 1 (one level of nesting).
	MaxNestingLevel int

	// OnGetPropertyKind is an optional callback invoked for each field to allow
	// callers to override the automatic PropertyKind classification.
	// C# ref: Config.ReportSettings.OnGetBusinessObjectPropertyKind
	OnGetPropertyKind func(args *GetPropertyKindEventArgs)

	// OnFilterProperties is an optional callback invoked for each field to allow
	// callers to skip (exclude) specific fields from the generated schema.
	// C# ref: Config.ReportSettings.OnFilterBusinessObjectProperties
	OnFilterProperties func(args *FilterPropertiesEventArgs)
	// contains filtered or unexported fields
}

BusinessObjectConverter builds and updates a DataColumn schema tree from a Go struct type using reflection. It is the Go port of the internal C# class FastReport.Base/Data/BusinessObjectConverter.cs.

Typical usage:

type Order struct {
    ID       int
    Customer string
    Lines    []OrderLine
}
root := data.NewDataColumn("Orders")
root.DataType = "[]Order"
conv := data.NewBusinessObjectConverter()
conv.CreateInitialObjects(root, reflect.TypeOf(Order{}), 2)

func NewBusinessObjectConverter

func NewBusinessObjectConverter() *BusinessObjectConverter

NewBusinessObjectConverter creates a BusinessObjectConverter with default settings (MaxNestingLevel = 1, no callbacks).

func (*BusinessObjectConverter) CreateInitialObjects

func (c *BusinessObjectConverter) CreateInitialObjects(col *DataColumn, structType reflect.Type, maxNestingLevel int)

CreateInitialObjects builds a full schema tree on col using structType as the root Go type. maxNestingLevel limits recursion depth (1 = one level of children).

C# ref: BusinessObjectConverter.CreateInitialObjects(Column, int)

func (*BusinessObjectConverter) GetPropertyKind

func (c *BusinessObjectConverter) GetPropertyKind(name string, t reflect.Type) PropertyKind

GetPropertyKind classifies a reflect.Type as Simple, Complex, or Enumerable. If OnGetPropertyKind is set, the callback can override the default classification. C# ref: BusinessObjectConverter.GetPropertyKind(string, Type)

func (*BusinessObjectConverter) UpdateExistingObjects

func (c *BusinessObjectConverter) UpdateExistingObjects(col *DataColumn, structType reflect.Type, maxNestingLevel int)

UpdateExistingObjects performs a delta update of an already-built schema tree. New fields are added, removed fields are deleted, and existing entries have their metadata refreshed. maxNestingLevel limits recursion depth.

C# ref: BusinessObjectConverter.UpdateExistingObjects(Column, int)

type BusinessObjectDataSource

type BusinessObjectDataSource struct {

	// LoadBusinessObject is called before data is loaded, enabling load-on-demand.
	LoadBusinessObject func(ds *BusinessObjectDataSource)
	// contains filtered or unexported fields
}

BusinessObjectDataSource binds a Go slice (or any value implementing []T where T is a struct or map) to a report band at run time. It is the Go equivalent of FastReport.Data.BusinessObjectDataSource.

Usage:

type Order struct{ ID int; Customer string; Amount float64 }
orders := []Order{{1,"Alice",99.9},{2,"Bob",50.0}}
ds := data.NewBusinessObjectDataSource("Orders", orders)
ds.Init()     // reflects columns from Order struct
ds.First()
for !ds.EOF() {
    v, _ := ds.GetValue("Customer")
    ds.Next()
}

func NewBusinessObjectDataSource

func NewBusinessObjectDataSource(name string, value any) *BusinessObjectDataSource

NewBusinessObjectDataSource creates a BusinessObjectDataSource bound to the given Go value. value must be a slice, array, or a single struct/map.

func (*BusinessObjectDataSource) Alias

func (b *BusinessObjectDataSource) Alias() string

Alias returns the data source alias.

func (*BusinessObjectDataSource) Close

func (b *BusinessObjectDataSource) Close() error

Close is a no-op for in-memory data sources.

func (*BusinessObjectDataSource) Columns

func (b *BusinessObjectDataSource) Columns() []Column

Columns returns the column metadata (populated after Init).

func (*BusinessObjectDataSource) CurrentRowNo

func (b *BusinessObjectDataSource) CurrentRowNo() int

CurrentRowNo returns the 0-based current row index.

func (*BusinessObjectDataSource) Deserialize

func (b *BusinessObjectDataSource) Deserialize(r report.Reader) error

Deserialize reads the data source's FRX properties from r and handles legacy compatibility:

  • If ReferenceName contains a dot (legacy .NET format), the last dot-separated segment becomes PropName and ReferenceName is cleared. C# ref: FastReport.Data.BusinessObjectDataSource.Deserialize line 159-164.

func (*BusinessObjectDataSource) EOF

func (b *BusinessObjectDataSource) EOF() bool

EOF returns true when all rows have been consumed.

func (*BusinessObjectDataSource) Enabled

func (b *BusinessObjectDataSource) Enabled() bool

Enabled returns whether this data source is active during report execution. C# ref: FastReport.Data.DataComponentBase.Enabled

func (*BusinessObjectDataSource) First

func (b *BusinessObjectDataSource) First() error

First positions at the first row. Returns ErrEOF when the data source has no rows (consistent with other data source implementations so that RunDataBandFull can detect empty sources).

func (*BusinessObjectDataSource) GetValue

func (b *BusinessObjectDataSource) GetValue(column string) (any, error)

GetValue returns the value of the named column in the current row. For struct rows, name is the field name (case-insensitive). For map[string]any rows, name is the map key.

func (*BusinessObjectDataSource) Init

func (b *BusinessObjectDataSource) Init() error

Init reflects the bound value to build row data and column metadata.

func (*BusinessObjectDataSource) Name

func (b *BusinessObjectDataSource) Name() string

Name returns the data source name.

func (*BusinessObjectDataSource) Next

func (b *BusinessObjectDataSource) Next() error

Next advances to the next row.

func (*BusinessObjectDataSource) PropName

func (b *BusinessObjectDataSource) PropName() string

PropName returns the property/field name used to bind this source to its parent. C# ref: FastReport.Data.DataSourceBase.PropName

func (*BusinessObjectDataSource) ReferenceName

func (b *BusinessObjectDataSource) ReferenceName() string

ReferenceName returns the FRX infrastructure reference name. C# ref: FastReport.Data.DataComponentBase.ReferenceName

func (*BusinessObjectDataSource) RowCount

func (b *BusinessObjectDataSource) RowCount() int

RowCount returns the total number of rows.

func (*BusinessObjectDataSource) Serialize

func (b *BusinessObjectDataSource) Serialize(w report.Writer) error

Serialize writes the data source's FRX properties to w. C# ref: FastReport.Data.BusinessObjectDataSource — inherits DataSourceBase.Serialize.

func (*BusinessObjectDataSource) SetAlias

func (b *BusinessObjectDataSource) SetAlias(a string)

SetAlias sets the alias.

func (*BusinessObjectDataSource) SetData

func (b *BusinessObjectDataSource) SetData(value any)

SetData replaces the bound value and marks the source as not initialized.

func (*BusinessObjectDataSource) SetEnabled

func (b *BusinessObjectDataSource) SetEnabled(v bool)

SetEnabled enables or disables this data source.

func (*BusinessObjectDataSource) SetName

func (b *BusinessObjectDataSource) SetName(n string)

SetName sets the data source name. When alias was previously equal to name (case-insensitively) or empty, it is kept in sync with the new name. Mirrors C# DataComponentBase.SetName alias-sync behaviour.

func (*BusinessObjectDataSource) SetPropName

func (b *BusinessObjectDataSource) SetPropName(p string)

SetPropName sets the property name used to bind this source to its parent.

func (*BusinessObjectDataSource) SetReferenceName

func (b *BusinessObjectDataSource) SetReferenceName(n string)

SetReferenceName sets the FRX infrastructure reference name.

type Column

type Column struct {
	// Name is the column name.
	Name string
	// Alias is the human-friendly display name.
	Alias string
	// DataType is a string describing the column type (e.g. "string", "int", "float64").
	DataType string
}

Column describes a single column in a data source.

type ColumnBindableControl

type ColumnBindableControl int

ColumnBindableControl specifies the type of report object created when a column is dropped on a report page. It is the Go equivalent of FastReport.Data.ColumnBindableControl. C# ref: FastReport.Base/Data/Column.cs

const (
	// ColumnBindableControlText creates a TextObject (default).
	ColumnBindableControlText ColumnBindableControl = iota
	// ColumnBindableControlRichText creates a RichObject.
	ColumnBindableControlRichText
	// ColumnBindableControlPicture creates a PictureObject.
	ColumnBindableControlPicture
	// ColumnBindableControlCheckBox creates a CheckBoxObject.
	ColumnBindableControlCheckBox
	// ColumnBindableControlCustom creates a custom object type specified by
	// CustomBindableControl.
	ColumnBindableControlCustom
)

type ColumnCollection

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

ColumnCollection is an ordered collection of DataColumns.

func NewColumnCollection

func NewColumnCollection() *ColumnCollection

NewColumnCollection creates an empty ColumnCollection with no owner.

func (*ColumnCollection) Add

func (cc *ColumnCollection) Add(col *DataColumn)

Add appends col to the collection. If the collection has an owner (i.e. it belongs to a DataColumn's Columns()), the child's parent pointer is set.

func (*ColumnCollection) All

func (cc *ColumnCollection) All() iter.Seq2[int, *DataColumn]

All returns an iterator over all columns (Go 1.23 range-over-func).

func (*ColumnCollection) Clear

func (cc *ColumnCollection) Clear()

Clear removes all columns.

func (*ColumnCollection) CreateUniqueAlias

func (cc *ColumnCollection) CreateUniqueAlias(alias string) string

CreateUniqueAlias returns a unique column alias based on the given base alias.

func (*ColumnCollection) CreateUniqueName

func (cc *ColumnCollection) CreateUniqueName(name string) string

CreateUniqueName returns a unique column name based on the given base name.

func (*ColumnCollection) FindByAlias

func (cc *ColumnCollection) FindByAlias(alias string) *DataColumn

FindByAlias returns the first column whose Alias matches (case-insensitive), or nil.

func (*ColumnCollection) FindByName

func (cc *ColumnCollection) FindByName(name string) *DataColumn

FindByName returns the first column whose Name matches (case-insensitive), or nil.

func (*ColumnCollection) FindByPropName

func (cc *ColumnCollection) FindByPropName(propName string) *DataColumn

FindByPropName returns the first column whose PropName matches, or nil. C# ref: FastReport.Data.Column.FindByPropName(string)

func (*ColumnCollection) Get

func (cc *ColumnCollection) Get(i int) *DataColumn

Get returns the column at index i.

func (*ColumnCollection) Len

func (cc *ColumnCollection) Len() int

Len returns the number of columns.

func (*ColumnCollection) Remove

func (cc *ColumnCollection) Remove(name string) bool

Remove removes the first column with the given name. Returns true if found and removed.

func (*ColumnCollection) Slice

func (cc *ColumnCollection) Slice() []*DataColumn

Slice returns a copy of the underlying slice.

func (*ColumnCollection) Sort

func (cc *ColumnCollection) Sort()

Sort sorts the collection of columns by Name (ascending, case-sensitive).

type ColumnFormat

type ColumnFormat int

ColumnFormat specifies how a column's value is formatted.

const (
	// ColumnFormatAuto determines format automatically from data type.
	ColumnFormatAuto ColumnFormat = iota
	// ColumnFormatGeneral applies no formatting.
	ColumnFormatGeneral
	// ColumnFormatNumber applies number formatting.
	ColumnFormatNumber
	// ColumnFormatCurrency applies currency formatting.
	ColumnFormatCurrency
	// ColumnFormatDate applies date formatting.
	ColumnFormatDate
	// ColumnFormatTime applies time formatting.
	ColumnFormatTime
	// ColumnFormatPercent applies percent formatting.
	ColumnFormatPercent
	// ColumnFormatBoolean applies boolean formatting.
	ColumnFormatBoolean
)

type CommandParameter

type CommandParameter struct {
	// Name is the parameter name (e.g. "@customerId").
	Name string
	// DataType is the SQL data type hint string (e.g. "int", "varchar").
	DataType string
	// Size is the maximum data size (e.g. for varchar columns).
	Size int
	// Expression is a report expression whose result is used as the value.
	Expression string
	// DefaultValue is used when Expression evaluates to nil.
	DefaultValue string
	// Direction indicates input/output direction.
	Direction ParameterDirection
	// Value holds the resolved run-time value.
	Value any
	// contains filtered or unexported fields
}

CommandParameter represents a parameter passed to a SQL command. It is the Go equivalent of FastReport.Data.CommandParameter.

func NewCommandParameter

func NewCommandParameter(name string) *CommandParameter

NewCommandParameter creates a CommandParameter with default Input direction.

func (*CommandParameter) Assign

func (p *CommandParameter) Assign(src *CommandParameter)

Assign copies all CommandParameter properties from src. Mirrors C# CommandParameter.Assign (CommandParameter.cs lines 159-169): Name, DataType, Size, Value, Expression, DefaultValue and Direction are all copied.

func (*CommandParameter) Deserialize

func (p *CommandParameter) Deserialize(r report.Reader) error

Deserialize reads CommandParameter properties from r.

func (*CommandParameter) GetExpressions

func (p *CommandParameter) GetExpressions() []string

GetExpressions returns the list of expressions used by this parameter. Mirrors C# CommandParameter.GetExpressions (CommandParameter.cs).

func (*CommandParameter) LastValue

func (p *CommandParameter) LastValue() any

LastValue returns the cached last-evaluated value.

func (*CommandParameter) ResetLastValue

func (p *CommandParameter) ResetLastValue()

ResetLastValue resets the cached value to the uninitialized sentinel, signalling that the parameter must be re-evaluated on the next use.

func (*CommandParameter) Serialize

func (p *CommandParameter) Serialize(w report.Writer) error

Serialize writes CommandParameter properties to w.

func (*CommandParameter) SetLastValue

func (p *CommandParameter) SetLastValue(v any)

SetLastValue sets the cached last-evaluated value.

type CommandParameterCollection

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

CommandParameterCollection is an ordered, named collection of CommandParameter objects. It is the Go equivalent of FastReport.Data.CommandParameterCollection.

func NewCommandParameterCollection

func NewCommandParameterCollection() *CommandParameterCollection

NewCommandParameterCollection creates an empty collection.

func (*CommandParameterCollection) Add

Add appends a parameter to the collection.

func (*CommandParameterCollection) All

All returns a copy of the internal slice.

func (*CommandParameterCollection) Count

func (c *CommandParameterCollection) Count() int

Count returns the number of parameters.

func (*CommandParameterCollection) CreateUniqueName

func (c *CommandParameterCollection) CreateUniqueName(name string) string

CreateUniqueName returns a unique parameter name based on name. If a parameter named name already exists, a numeric suffix is appended until the name is unique.

func (*CommandParameterCollection) Deserialize

func (c *CommandParameterCollection) Deserialize(r report.Reader) error

Deserialize reads all "Parameter" children from r into the collection.

func (*CommandParameterCollection) FindByName

func (c *CommandParameterCollection) FindByName(name string) *CommandParameter

FindByName returns the parameter with the given name, or nil if not found.

func (*CommandParameterCollection) Get

Get returns the parameter at index i.

func (*CommandParameterCollection) Remove

Remove removes a parameter by reference.

func (*CommandParameterCollection) Serialize

Serialize writes all parameters to w as child elements named "Parameter".

type DataColumn

type DataColumn struct {
	// Name is the column's programmatic name.
	Name string
	// Alias is the human-friendly display name.
	Alias string
	// DataType is a string describing the column's value type (e.g. "string", "int64").
	DataType string
	// Format specifies the display format.
	Format ColumnFormat
	// BindableControl specifies the type of report object created when this
	// column is dropped on a report page. Defaults to ColumnBindableControlText.
	// C# ref: FastReport.Data.Column.BindableControl
	BindableControl ColumnBindableControl
	// CustomBindableControl specifies the type name of a custom object when
	// BindableControl is ColumnBindableControlCustom.
	// C# ref: FastReport.Data.Column.CustomBindableControl
	CustomBindableControl string
	// Calculated is true when the column value comes from an expression.
	Calculated bool
	// Expression is the formula used for calculated columns.
	Expression string
	// Enabled controls whether the column is active.
	Enabled bool
	// PropName is the bound business-object property name.
	// When empty it defaults to the same value as Name.
	PropName string
	// Tag holds arbitrary runtime metadata (not serialized).
	// C# ref: FastReport.Data.Column.Tag (internal)
	Tag any
	// contains filtered or unexported fields
}

DataColumn represents a single data column in a data source. It is the Go equivalent of FastReport.Data.Column.

func GetColumn

func GetColumn(dict DictionaryLookup, complexName string) *DataColumn

GetColumn resolves a dot-separated column reference such as "Orders.CustomerID" or relation-based paths like "Orders.Customers.Name". It mirrors the C# helper at a flat-column level using the Go datasource model.

func GetColumnFromParts

func GetColumnFromParts(dict DictionaryLookup, data DataSource, names []string, initRelation bool) *DataColumn

GetColumnFromParts resolves a column reference starting from an already resolved datasource. When initRelation is true, relation traversal is allowed but row initialization side effects from the C# implementation are not needed in the current Go engine, so it behaves the same as false.

func NewDataColumn

func NewDataColumn(name string) *DataColumn

NewDataColumn creates a DataColumn with the given name and enabled=true. PropName is initialised to name (matching C# Column constructor + SetName).

func (*DataColumn) Columns

func (c *DataColumn) Columns() *ColumnCollection

Columns returns the nested column collection, creating it on first access. The collection's owner is set to c so that added children get their parent pointer set automatically.

func (*DataColumn) Deserialize

func (c *DataColumn) Deserialize(r report.Reader) error

Deserialize reads the column's properties from r. C# ref: FastReport.Data.Column — properties auto-read by FRReader; Go requires explicit reads.

func (*DataColumn) FullName

func (c *DataColumn) FullName() string

FullName returns the dot-separated qualified name of this column, walking up through parent columns. For a top-level column this is just the Alias; for nested columns it is "Parent.Child". C# ref: FastReport.Data.Column.FullName

func (*DataColumn) GetExpressions

func (c *DataColumn) GetExpressions() []string

GetExpressions returns the list of expressions used by this column. For calculated columns it returns a single-element slice containing the Expression; for regular columns it returns nil. C# ref: FastReport.Data.Column.GetExpressions()

func (*DataColumn) HasColumns

func (c *DataColumn) HasColumns() bool

HasColumns returns true if this column has nested child columns.

func (*DataColumn) Parent

func (c *DataColumn) Parent() *DataColumn

Parent returns the owning DataColumn for nested columns, or nil for top-level columns.

func (*DataColumn) Serialize

func (c *DataColumn) Serialize(w report.Writer) error

Serialize writes the column's non-default properties to w. C# ref: FastReport.Data.Column.Serialize(FRWriter)

func (*DataColumn) SetBindableControlType

func (c *DataColumn) SetBindableControlType(goType string)

SetBindableControlType sets BindableControl based on the Go type string. Byte slice and image types → Picture; bool → CheckBox; anything else → Text. C# ref: FastReport.Data.Column.SetBindableControlType(Type)

func (*DataColumn) SetName

func (c *DataColumn) SetName(name string)

SetName sets the column's Name and, when PropName was previously synced with Name (or empty), keeps PropName in sync. This mirrors C# Column.SetName.

func (*DataColumn) SetParent

func (c *DataColumn) SetParent(p *DataColumn)

SetParent sets the owning parent column.

type DataComponentBase

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

DataComponentBase is the base for all data components: connections, data sources, and columns. It is the Go equivalent of FastReport.Data.DataComponentBase.

DataComponentBase adds Alias, Enabled, ReferenceName, and Reference fields on top of the minimal report.Base contract. Both DataConnectionBase and BaseDataSource should embed it to gain consistent FRX serialization.

func NewDataComponentBase

func NewDataComponentBase(name string) *DataComponentBase

NewDataComponentBase creates a DataComponentBase with Enabled=true.

func (*DataComponentBase) Alias

func (d *DataComponentBase) Alias() string

Alias returns the human-friendly display name.

func (*DataComponentBase) Deserialize

func (d *DataComponentBase) Deserialize(r report.Reader) error

Deserialize reads the component's properties from r.

func (*DataComponentBase) Enabled

func (d *DataComponentBase) Enabled() bool

Enabled returns whether this component is active.

func (*DataComponentBase) InitializeComponent

func (d *DataComponentBase) InitializeComponent()

InitializeComponent is called by the engine before running a report. Subclasses override this to perform late initialization. The base implementation is intentionally a no-op; types that embed DataComponentBase override this method to add their own setup logic.

func (*DataComponentBase) IsAliased

func (d *DataComponentBase) IsAliased() bool

IsAliased returns true when the alias differs from the name.

func (*DataComponentBase) Name

func (d *DataComponentBase) Name() string

Name returns the component's internal name.

func (*DataComponentBase) Reference

func (d *DataComponentBase) Reference() any

Reference returns the run-time reference object.

func (*DataComponentBase) ReferenceName

func (d *DataComponentBase) ReferenceName() string

ReferenceName returns the infrastructure reference name.

func (*DataComponentBase) Serialize

func (d *DataComponentBase) Serialize(w report.Writer) error

Serialize writes the component's non-default properties to w.

func (*DataComponentBase) SetAlias

func (d *DataComponentBase) SetAlias(a string)

SetAlias sets the display alias.

func (*DataComponentBase) SetEnabled

func (d *DataComponentBase) SetEnabled(v bool)

SetEnabled enables or disables this component.

func (*DataComponentBase) SetName

func (d *DataComponentBase) SetName(name string)

SetName sets the internal name. When alias was empty or case-insensitively equal to the old name it is also updated to stay in sync, matching the C# behaviour:

bool changeAlias = String.IsNullOrEmpty(Alias) ||
                   String.Compare(Alias, Name, true) == 0;

func (*DataComponentBase) SetReference

func (d *DataComponentBase) SetReference(ref any)

SetReference sets the run-time reference object.

func (*DataComponentBase) SetReferenceName

func (d *DataComponentBase) SetReferenceName(n string)

SetReferenceName sets the infrastructure reference name.

type DataConnectionBase

type DataConnectionBase struct {
	DataComponentBase

	// ConnectionString is the DSN or connection string.
	ConnectionString string
	// ConnectionStringExpression is a report expression that resolves to the DSN.
	ConnectionStringExpression string
	// LoginPrompt causes the engine to prompt for credentials at run time.
	LoginPrompt bool
	// CommandTimeout is the per-query timeout in seconds (default 30, per C# default).
	CommandTimeout int

	// OnDatabaseLogin is an optional callback invoked just before sql.Open.
	// The callback receives a *DatabaseLoginEventArgs whose ConnectionString is
	// pre-filled with the current value; the callback may replace it.
	// C# ref: ReportSettings.DatabaseLogin event / Core.cs OnDatabaseLogin.
	OnDatabaseLogin func(e *DatabaseLoginEventArgs)

	// OnAfterDatabaseLogin is an optional callback invoked after sql.Open succeeds.
	// The callback receives a *AfterDatabaseLoginEventArgs with the open *sql.DB.
	// C# ref: ReportSettings.AfterDatabaseLogin event / ReportSettings.OnAfterDatabaseLogin.
	OnAfterDatabaseLogin func(e *AfterDatabaseLoginEventArgs)

	// OnFilterConnectionTables is an optional callback invoked for each table name
	// during CreateAllTables. Set e.Skip = true to exclude a table.
	// C# ref: FastReport.Utils.Config.OnFilterConnectionTables event.
	OnFilterConnectionTables func(e *FilterConnectionTablesEventArgs)
	// contains filtered or unexported fields
}

DataConnectionBase is the abstract base for all database connections. It is the Go equivalent of FastReport.Data.DataConnectionBase.

Concrete connection types (Postgres, MySQL, SQLite …) embed this struct and provide a sql.DB via the Open() method.

func NewDataConnectionBase

func NewDataConnectionBase(driverName string) *DataConnectionBase

NewDataConnectionBase creates a DataConnectionBase for the given sql driver. Defaults match C# DataConnectionBase constructor: IsSqlBased=true, CommandTimeout=30.

func (*DataConnectionBase) AddTable

func (c *DataConnectionBase) AddTable(t *TableDataSource)

AddTable registers a TableDataSource with this connection.

func (*DataConnectionBase) CanContainProcedures

func (c *DataConnectionBase) CanContainProcedures() bool

CanContainProcedures returns whether this connection can contain stored procedures. C# ref: FastReport.Data.DataConnectionBase.CanContainProcedures

func (*DataConnectionBase) Close

func (c *DataConnectionBase) Close() error

Close closes the underlying *sql.DB.

func (*DataConnectionBase) CreateAllTables

func (c *DataConnectionBase) CreateAllTables()

CreateAllTables fills the Tables collection with all tables available in the connection (calls GetTableNames, removes stale tables, creates new ones) and then calls InitSchema on each table. C# ref: FastReport.Data.DataConnectionBase.CreateAllTables()

func (*DataConnectionBase) CreateAllTablesWithSchema

func (c *DataConnectionBase) CreateAllTablesWithSchema(initSchema bool)

CreateAllTablesWithSchema fills the Tables collection. When initSchema is true each table's schema is initialised by calling InitSchema(). C# ref: FastReport.Data.DataConnectionBase.CreateAllTables(bool initSchema)

func (*DataConnectionBase) CreateTable

func (c *DataConnectionBase) CreateTable(name string) *TableDataSource

CreateTable creates a TableDataSource with the given name and registers it.

func (*DataConnectionBase) DB

func (c *DataConnectionBase) DB() *sql.DB

DB returns the open *sql.DB, or nil if not yet opened.

func (*DataConnectionBase) DeleteTable

func (c *DataConnectionBase) DeleteTable(source *TableDataSource)

DeleteTable removes the TableDataSource from the tables collection and resets its internal table reference (equivalent to C# DataSet table removal). C# ref: FastReport.Data.DataConnectionBase.DeleteTable

func (*DataConnectionBase) Deserialize

func (c *DataConnectionBase) Deserialize(r report.Reader) error

Deserialize reads the connection's properties from r. Child TableDataSource elements are read back as registered tables. C# ref: FastReport.Data.DataConnectionBase.Deserialize (implicit via FRX load)

func (*DataConnectionBase) DriverName

func (c *DataConnectionBase) DriverName() string

DriverName returns the database/sql driver name.

func (*DataConnectionBase) FillTable

func (c *DataConnectionBase) FillTable(source *TableDataSource) error

FillTable reloads data for the given source when needed: - when ForceLoadData is true, or - when any parameter value has changed since the last load. C# ref: FastReport.Data.DataConnectionBase.FillTable (internal)

func (*DataConnectionBase) FilterTables

func (c *DataConnectionBase) FilterTables(tableNames []string) []string

FilterTables is a hook called by CreateAllTables to allow subclasses or callers to remove table names from the list before table objects are created. The base implementation is a no-op. C# ref: FastReport.Data.DataConnectionBase.FilterTables (virtual, no-op in base)

func (*DataConnectionBase) GetCommandBuilder

func (c *DataConnectionBase) GetCommandBuilder() any

GetCommandBuilder returns a connection-specific command builder, or nil if the base connection does not provide one. Concrete connection subclasses that support schema-querying command builders should override this. C# ref: FastReport.Data.DataConnectionBase.GetAdapter (analogous virtual method).

func (*DataConnectionBase) GetTableCount

func (c *DataConnectionBase) GetTableCount() int

GetTableCount returns the number of tables/views available in this connection. C# ref: derived from GetTableNames().

func (*DataConnectionBase) GetTableNames

func (c *DataConnectionBase) GetTableNames() []string

GetTableNames returns the list of table and view names available in this connection. The base implementation returns an empty slice; SQL-based subclasses override this to query the database schema. C# ref: FastReport.Data.DataConnectionBase.GetTableNames()

func (*DataConnectionBase) IsSqlBased

func (c *DataConnectionBase) IsSqlBased() bool

IsSqlBased returns whether this connection is SQL-based. C# ref: FastReport.Data.DataConnectionBase.IsSqlBased

func (*DataConnectionBase) Open

func (c *DataConnectionBase) Open() error

Open opens the underlying *sql.DB using the ConnectionString. Returns an error if the connection cannot be established.

If OnDatabaseLogin is set it is called before sql.Open with the current ConnectionString; the callback may replace it. If OnAfterDatabaseLogin is set it is called after sql.Open succeeds. C# ref: FastReport.Base/Data/DataConnectionBase.cs Open() which calls Config.ReportSettings.OnDatabaseLogin and Config.ReportSettings.OnAfterDatabaseLogin.

func (*DataConnectionBase) Serialize

func (c *DataConnectionBase) Serialize(w report.Writer) error

Serialize writes the connection's properties to w. Child TableDataSources that are enabled are written as child elements. C# ref: FastReport.Data.DataConnectionBase.Serialize

func (*DataConnectionBase) SetCanContainProcedures

func (c *DataConnectionBase) SetCanContainProcedures(v bool)

SetCanContainProcedures sets the CanContainProcedures flag.

func (*DataConnectionBase) SetIsSqlBased

func (c *DataConnectionBase) SetIsSqlBased(v bool)

SetIsSqlBased sets the IsSqlBased flag.

func (*DataConnectionBase) Tables

func (c *DataConnectionBase) Tables() []*TableDataSource

Tables returns the TableDataSources registered with this connection.

type DataConnectionCollection

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

DataConnectionCollection provides ordered, named access to a set of DataConnectionBase objects. It is the Go equivalent of FastReport.Data.DataConnectionCollection.

func NewDataConnectionCollection

func NewDataConnectionCollection() *DataConnectionCollection

NewDataConnectionCollection creates an empty collection.

func (*DataConnectionCollection) Add

Add appends a connection to the collection.

func (*DataConnectionCollection) All

All returns a copy of the internal slice.

func (*DataConnectionCollection) Count

func (c *DataConnectionCollection) Count() int

Count returns the number of connections.

func (*DataConnectionCollection) FindByName

func (c *DataConnectionCollection) FindByName(name string) *DataConnectionBase

FindByName returns the connection with the given name (case-insensitive), or nil if not found.

func (*DataConnectionCollection) Get

Get returns the connection at index i.

func (*DataConnectionCollection) Remove

Remove removes a connection by reference.

type DataSource

type DataSource interface {
	// Name returns the data source name.
	Name() string
	// Alias returns the human-friendly alias.
	Alias() string
	// Init initializes the data source and loads data.
	Init() error
	// First positions at the first row (equivalent to CurrentRowNo = 0).
	First() error
	// Next advances to the next row. Returns ErrEOF at end.
	Next() error
	// EOF returns true when all rows have been consumed.
	EOF() bool
	// RowCount returns the total number of rows.
	RowCount() int
	// CurrentRowNo returns the 0-based index of the current row.
	CurrentRowNo() int
	// GetValue returns the value of the named column in the current row.
	// Returns nil if the column does not exist.
	GetValue(column string) (any, error)
	// Close releases resources held by the data source.
	Close() error
}

DataSource is the primary interface for all data providers. It is the Go equivalent of DataSourceBase with a simplified Go-idiomatic API.

func GetDataSource

func GetDataSource(dict DictionaryLookup, complexName string) DataSource

GetDataSource resolves a dot-separated complex name (e.g. "Orders.Details") to the deepest matching data source in the dictionary. Returns nil when not found.

type DataSourceCollection

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

DataSourceCollection provides ordered, named access to DataSource objects. It is the Go equivalent of FastReport.Data.DataSourceCollection.

func NewDataSourceCollection

func NewDataSourceCollection() *DataSourceCollection

NewDataSourceCollection creates an empty collection.

func (*DataSourceCollection) Add

func (c *DataSourceCollection) Add(ds DataSource)

Add appends a data source to the collection.

func (*DataSourceCollection) All

func (c *DataSourceCollection) All() []DataSource

All returns a copy of the internal slice.

func (*DataSourceCollection) Count

func (c *DataSourceCollection) Count() int

Count returns the number of data sources.

func (*DataSourceCollection) FindByAlias

func (c *DataSourceCollection) FindByAlias(alias string) DataSource

FindByAlias returns the data source with the given alias (case-insensitive), or nil if not found.

func (*DataSourceCollection) FindByName

func (c *DataSourceCollection) FindByName(name string) DataSource

FindByName returns the data source with the given name (case-insensitive), or nil if not found.

func (*DataSourceCollection) Get

Get returns the data source at index i.

func (*DataSourceCollection) Remove

func (c *DataSourceCollection) Remove(ds DataSource)

Remove removes a data source by reference.

func (*DataSourceCollection) Sort

func (c *DataSourceCollection) Sort()

Sort sorts data sources by their aliases (ascending). C# ref: FastReport.Data.DataSourceCollection.Sort()

type DataSourceFilter

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

DataSourceFilter holds an ordered list of filter conditions. All conditions must match for a value to pass (AND semantics). It is the Go equivalent of FastReport.Data.DataSourceFilter.

func NewDataSourceFilter

func NewDataSourceFilter() *DataSourceFilter

NewDataSourceFilter creates an empty DataSourceFilter.

func (*DataSourceFilter) Add

Add appends a filter condition and returns the new FilterElement.

func (*DataSourceFilter) Clear

func (f *DataSourceFilter) Clear()

Clear removes all filter conditions.

func (*DataSourceFilter) Len

func (f *DataSourceFilter) Len() int

Len returns the number of filter conditions.

func (*DataSourceFilter) Remove

func (f *DataSourceFilter) Remove(fe *FilterElement)

Remove removes the given FilterElement from the filter.

func (*DataSourceFilter) ValueMatch

func (f *DataSourceFilter) ValueMatch(value any) bool

ValueMatch returns true when value satisfies all filter conditions. An empty filter always returns true.

type DatabaseLoginEventArgs

type DatabaseLoginEventArgs struct {
	// ConnectionString is the DSN passed to the connection. The callback may
	// replace it to inject credentials or switch to a different server.
	ConnectionString string
	// UserName is an optional credential field available for custom Open() overrides.
	UserName string
	// Password is an optional credential field available for custom Open() overrides.
	Password string
}

DatabaseLoginEventArgs carries the connection string passed to the OnDatabaseLogin callback. The callback may override ConnectionString, or set UserName/Password, before the connection is opened. C# ref: FastReport.DatabaseLoginEventArgs (ReportEventArgs.cs). / ReportSettings.Core.cs OnDatabaseLogin → fires DatabaseLogin event.

type Dictionary

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

Dictionary is the central registry for all data components in a report: data sources, connections, relations, parameters, system variables, and totals. It is the Go equivalent of FastReport.Data.Dictionary.

func NewDictionary

func NewDictionary() *Dictionary

NewDictionary creates an empty Dictionary.

func (*Dictionary) AddAggregateTotal

func (d *Dictionary) AddAggregateTotal(at *AggregateTotal)

AddAggregateTotal registers an aggregate total definition. It also ensures a corresponding simple Total entry exists in Totals() so that the expression evaluator can reference the current accumulated value by name.

func (*Dictionary) AddConnection

func (d *Dictionary) AddConnection(c *DataConnectionBase)

AddConnection registers a database connection.

func (*Dictionary) AddDataSource

func (d *Dictionary) AddDataSource(ds DataSource)

AddDataSource registers a data source.

func (*Dictionary) AddParameter

func (d *Dictionary) AddParameter(p *Parameter)

AddParameter registers a report parameter.

func (*Dictionary) AddRelation

func (d *Dictionary) AddRelation(r *Relation)

AddRelation registers a master-detail relation.

func (*Dictionary) AddSystemVariable

func (d *Dictionary) AddSystemVariable(p *Parameter)

AddSystemVariable registers a system variable.

func (*Dictionary) AddTotal

func (d *Dictionary) AddTotal(t *Total)

AddTotal registers an aggregate total.

func (*Dictionary) AggregateTotals

func (d *Dictionary) AggregateTotals() []*AggregateTotal

AggregateTotals returns all aggregate total definitions.

func (*Dictionary) Connections

func (d *Dictionary) Connections() []*DataConnectionBase

Connections returns all registered database connections.

func (*Dictionary) CreateUniqueAlias

func (d *Dictionary) CreateUniqueAlias(alias string) string

CreateUniqueAlias returns an alias that does not collide with any existing data source alias in the dictionary. When alias is already unique it is returned as-is; otherwise a numeric suffix is appended until unique. Mirrors C# DictionaryHelper.CreateUniqueAlias (DictionaryHelper.cs:80-90).

func (*Dictionary) CreateUniqueName

func (d *Dictionary) CreateUniqueName(name string) string

CreateUniqueName returns a data source name that does not collide with any existing data source name in the dictionary. When name is already unique it is returned as-is; otherwise a numeric suffix is appended until unique. Mirrors C# DictionaryHelper.CreateUniqueName (DictionaryHelper.cs:92-100).

func (*Dictionary) DataSources

func (d *Dictionary) DataSources() []DataSource

DataSources returns all registered data sources.

func (*Dictionary) Evaluate

func (d *Dictionary) Evaluate(complexName string) (any, error)

Evaluate returns the effective value of the parameter identified by complexName. For simple parameters the raw Value is returned. When the parameter's Expression field is non-empty, it is evaluated using the expr evaluator with all top-level parameters and system variables available in scope.

complexName may be dot-separated (e.g. "Filters.MinDate") to address nested parameters — the same resolution rules as FindParameter apply.

Returns an error when the parameter does not exist or the expression fails to compile or evaluate.

func (*Dictionary) EvaluateAll

func (d *Dictionary) EvaluateAll() error

EvaluateAll evaluates all top-level parameters that have an Expression set and stores the result back into their Value field. This is typically called once before the engine runs so that expression-based parameters are resolved.

func (*Dictionary) FindConnectionByName

func (d *Dictionary) FindConnectionByName(name string) *DataConnectionBase

FindConnectionByName returns the connection with the given name (case-insensitive), or nil if not found.

func (*Dictionary) FindDataSourceByAlias

func (d *Dictionary) FindDataSourceByAlias(alias string) DataSource

FindDataSourceByAlias returns the data source with the given alias, or nil if not found.

func (*Dictionary) FindDataSourceByName

func (d *Dictionary) FindDataSourceByName(name string) DataSource

FindDataSourceByName returns the data source with the given name, or nil if not found.

func (*Dictionary) FindParameter

func (d *Dictionary) FindParameter(name string) *Parameter

FindParameter returns the parameter with the given name (dot-separated for nested), or nil if not found.

func (*Dictionary) FindTotal

func (d *Dictionary) FindTotal(name string) *Total

FindTotal returns the total with the given name, or nil.

func (*Dictionary) Merge

func (d *Dictionary) Merge(source *Dictionary)

Merge merges data sources, connections, parameters, and totals from source into this dictionary, skipping any entry whose name already exists. Mirrors C# Dictionary.Merge(source) (Dictionary.cs:725-780) — the Go port uses a simple name-deduplication approach instead of the C# clone-and-fixup.

func (*Dictionary) Parameters

func (d *Dictionary) Parameters() []*Parameter

Parameters returns all report parameters.

func (*Dictionary) RegisterData

func (d *Dictionary) RegisterData(value any, name string) DataSource

RegisterData is the high-level method for binding Go values to the dictionary. It creates a BusinessObjectDataSource with the given name and registers it.

func (*Dictionary) Relations

func (d *Dictionary) Relations() []*Relation

Relations returns all registered relations.

func (*Dictionary) RemoveConnection

func (d *Dictionary) RemoveConnection(c *DataConnectionBase)

RemoveConnection removes a connection by reference.

func (*Dictionary) RemoveDataSource

func (d *Dictionary) RemoveDataSource(ds DataSource)

RemoveDataSource removes a data source by reference.

func (*Dictionary) RemoveParameter

func (d *Dictionary) RemoveParameter(p *Parameter)

RemoveParameter removes a parameter by reference.

func (*Dictionary) RemoveRelation

func (d *Dictionary) RemoveRelation(r *Relation)

RemoveRelation removes a relation by reference.

func (*Dictionary) RemoveTotal

func (d *Dictionary) RemoveTotal(t *Total)

RemoveTotal removes a total by reference.

func (*Dictionary) ResolveRelations

func (d *Dictionary) ResolveRelations()

ResolveRelations resolves ParentDataSource and ChildDataSource for each relation from their string names, and also splits ParentColumnNames / ChildColumnNames into the ParentColumns / ChildColumns slices. Call this after all data sources have been registered (typically at Prepare time).

func (*Dictionary) SetSystemVariable

func (d *Dictionary) SetSystemVariable(name string, value any)

SetSystemVariable sets the value of an existing system variable by name, or creates it if it does not exist.

func (*Dictionary) SystemVariables

func (d *Dictionary) SystemVariables() []*Parameter

SystemVariables returns all system variables.

func (*Dictionary) Totals

func (d *Dictionary) Totals() []*Total

Totals returns all registered totals.

type DictionaryLookup

type DictionaryLookup interface {
	// FindDataSourceByAlias returns the data source with the given alias, or nil.
	FindDataSourceByAlias(alias string) DataSource
	// Relations returns all defined master-detail relations.
	Relations() []*Relation
	// Parameters returns the top-level parameter slice.
	Parameters() []*Parameter
	// SystemVariables returns the built-in system variable parameters.
	SystemVariables() []*Parameter
	// Totals returns all defined totals.
	Totals() []*Total
}

DictionaryLookup is the minimal interface that DataHelper needs from the report Dictionary. The full Dictionary implementation satisfies this interface.

type FilterConnectionTablesEventArgs

type FilterConnectionTablesEventArgs struct {
	// Connection is the DataConnectionBase that owns the table list.
	Connection *DataConnectionBase
	// TableName is the candidate table name being evaluated.
	TableName string
	// Skip, when set to true by the callback, causes the table to be excluded.
	Skip bool
}

FilterConnectionTablesEventArgs carries the context passed to the OnFilterConnectionTables callback. Set Skip = true to exclude the table. C# ref: FastReport.Utils.Config.FilterConnectionTablesEventArgs.

type FilterElement

type FilterElement struct {
	// Value is the filter comparison value.
	Value any
	// Operation is the comparison operator.
	Operation FilterOperation
	// contains filtered or unexported fields
}

FilterElement represents a single filter condition.

type FilterOperation

type FilterOperation int

FilterOperation specifies how to compare a data value against a filter value.

const (
	// FilterEqual matches when data value equals filter value.
	FilterEqual FilterOperation = iota
	// FilterNotEqual matches when data value does not equal filter value.
	FilterNotEqual
	// FilterLessThan matches when data value is less than filter value.
	FilterLessThan
	// FilterLessThanOrEqual matches when data value is ≤ filter value.
	FilterLessThanOrEqual
	// FilterGreaterThan matches when data value is greater than filter value.
	FilterGreaterThan
	// FilterGreaterThanOrEqual matches when data value is ≥ filter value.
	FilterGreaterThanOrEqual
	// FilterContains matches when data string contains filter string.
	FilterContains
	// FilterNotContains matches when data string does not contain filter string.
	FilterNotContains
	// FilterStartsWith matches when data string starts with filter string.
	FilterStartsWith
	// FilterNotStartsWith matches when data string does not start with filter string.
	FilterNotStartsWith
	// FilterEndsWith matches when data string ends with filter string.
	FilterEndsWith
	// FilterNotEndsWith matches when data string does not end with filter string.
	FilterNotEndsWith
)

type FilterPropertiesEventArgs

type FilterPropertiesEventArgs struct {
	// FieldName is the struct field name.
	FieldName string
	// FieldType is the reflect.Type of the field.
	FieldType reflect.Type
	// Skip controls whether this field should be omitted. Default false.
	Skip bool
}

FilterPropertiesEventArgs carries the context passed to the OnFilterProperties callback. Set Skip = true to exclude the field from the generated schema. C# ref: FastReport.Data.FilterPropertiesEventArgs

type FilteredDataSource

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

FilteredDataSource wraps a DataSource and iterates only those rows whose specified columns equal specified parent values. It is used by the engine to implement master-detail relation filtering: before rendering each parent row, the engine creates (or updates) a FilteredDataSource for each child DataBand so that the child only sees rows whose join-key columns match the current parent row values.

func NewFilteredDataSource

func NewFilteredDataSource(inner DataSource, childColumns, parentValues []string) (*FilteredDataSource, error)

NewFilteredDataSource creates a FilteredDataSource wrapping inner. keys maps child column names → required values (equality check).

The constructor calls inner.First() internally to scan all rows, so inner must already be initialized and positioned at start (or First() called).

func (*FilteredDataSource) Alias

func (f *FilteredDataSource) Alias() string

Alias delegates to inner.

func (*FilteredDataSource) Close

func (f *FilteredDataSource) Close() error

Close delegates to inner.

func (*FilteredDataSource) Columns

func (f *FilteredDataSource) Columns() []Column

Columns returns the column list from inner if it exposes one.

func (*FilteredDataSource) CurrentRowNo

func (f *FilteredDataSource) CurrentRowNo() int

CurrentRowNo returns the cursor position within the filtered rows (0-based).

func (*FilteredDataSource) EOF

func (f *FilteredDataSource) EOF() bool

EOF returns true when all matching rows have been consumed.

func (*FilteredDataSource) First

func (f *FilteredDataSource) First() error

First positions at the first matching row.

func (*FilteredDataSource) GetValue

func (f *FilteredDataSource) GetValue(column string) (any, error)

GetValue delegates to inner for the current row.

func (*FilteredDataSource) Init

func (f *FilteredDataSource) Init() error

Init is a no-op for FilteredDataSource since the index is built at construction time. Calling inner.Init() would reset the inner source and lose the cursor position needed for row-level access.

func (*FilteredDataSource) Inner

func (f *FilteredDataSource) Inner() DataSource

Inner returns the underlying (unfiltered) DataSource that this FilteredDataSource wraps. Used by relation-matching code to unwrap the filter layer when comparing data source pointers.

func (*FilteredDataSource) Name

func (f *FilteredDataSource) Name() string

Name delegates to inner.

func (*FilteredDataSource) Next

func (f *FilteredDataSource) Next() error

Next advances to the next matching row.

func (*FilteredDataSource) RowCount

func (f *FilteredDataSource) RowCount() int

RowCount returns the number of rows that pass the filter.

type GetPropertyKindEventArgs

type GetPropertyKindEventArgs struct {
	// Name is the field/property name being classified.
	Name string
	// Type is the reflect.Type of the field.
	Type reflect.Type
	// Kind is the default classification; the callback may change it.
	Kind PropertyKind
}

GetPropertyKindEventArgs carries the context passed to the OnGetPropertyKind callback. The callback can override Kind before BusinessObjectConverter uses it. C# ref: FastReport.Data.GetPropertyKindEventArgs

type Parameter

type Parameter struct {
	// Name is the parameter name.
	Name string
	// Value is the current runtime value.
	Value any
	// Expression is an optional expression string for computed parameters.
	Expression string
	// DataType describes the expected Go type (e.g. "string", "int64").
	DataType string
	// Description is a human-readable description of this parameter.
	Description string
	// contains filtered or unexported fields
}

Parameter represents a named report parameter with an optional nested parameter collection. It is the Go equivalent of FastReport.Data.Parameter.

func CreateParameter

func CreateParameter(dict *Dictionary, complexName string) *Parameter

CreateParameter resolves or creates a nested parameter chain.

func FindParameterByName

func FindParameterByName(params []*Parameter, name string) *Parameter

FindByName returns the first nested parameter with the given name (case-insensitive), or nil. C# ParameterCollection.FindByName uses case-insensitive comparison.

func GetParameter

func GetParameter(dict DictionaryLookup, complexName string) *Parameter

GetParameter resolves a dot-separated complex name (e.g. "Filters.MinDate") through the nested parameter hierarchy. Returns nil when not found. Also searches system variables when a single-segment name is not found in user parameters.

func (*Parameter) AddParameter

func (p *Parameter) AddParameter(child *Parameter)

AddParameter appends a nested parameter.

func (*Parameter) Parameters

func (p *Parameter) Parameters() []*Parameter

Parameters returns the nested child parameters slice (creates it on demand).

type ParameterDirection

type ParameterDirection int

ParameterDirection specifies whether a command parameter is input, output, or both. Mirrors C# System.Data.ParameterDirection enum names.

const (
	ParamDirectionInput ParameterDirection = iota
	ParamDirectionOutput
	ParamDirectionInputOutput
	ParamDirectionReturnValue
)

type PropertyKind

type PropertyKind int

PropertyKind specifies the kind of a reflected property. C# ref: FastReport.Data.PropertyKind

const (
	// PropertyKindSimple indicates a property of a simple (value) type such as
	// int, string, bool, float64, []byte, or time.Time.
	PropertyKindSimple PropertyKind = iota

	// PropertyKindComplex indicates a complex property — a struct or pointer-to-struct
	// whose own fields should be reflected recursively.
	PropertyKindComplex

	// PropertyKindEnumerable indicates a property that is a slice, array, or other
	// iterable sequence of objects (equivalent to C# IEnumerable).
	PropertyKindEnumerable
)

type Relation

type Relation struct {
	// Name is the relation's unique name.
	Name string
	// Alias is the human-friendly display name (defaults to Name).
	Alias string
	// Enabled controls whether this relation is active.
	Enabled bool
	// ParentDataSource is the parent (master) data source (resolved at prepare time).
	ParentDataSource DataSource
	// ChildDataSource is the child (detail) data source (resolved at prepare time).
	ChildDataSource DataSource
	// ParentSourceName is the FRX-level data source name for the parent.
	// The engine resolves this to ParentDataSource via the dictionary.
	ParentSourceName string
	// ChildSourceName is the FRX-level data source name for the child.
	ChildSourceName string
	// ParentColumns are the join column names in the parent data source.
	// Populated from ParentColumnNames after dictionary resolution.
	ParentColumns []string
	// ChildColumns are the join column names in the child data source.
	// Populated from ChildColumnNames after dictionary resolution.
	ChildColumns []string
	// ParentColumnNames holds the raw comma-split column names from FRX.
	ParentColumnNames []string
	// ChildColumnNames holds the raw comma-split column names from FRX.
	ChildColumnNames []string
}

Relation describes a master-detail relationship between two data sources. It is the Go equivalent of FastReport.Data.Relation.

func FindRelation

func FindRelation(dict DictionaryLookup, parent, child DataSource) *Relation

FindRelation returns the Relation where parent and child match the given data sources, or nil when no such relation is registered. It first compares resolved DataSource pointers; if those are nil it falls back to matching by data source name. FilteredDataSource wrappers are unwrapped before pointer comparison so that nested master-detail bands (whose parent DS is already wrapped) still find the correct relation for their own children.

func NewRelation

func NewRelation() *Relation

NewRelation creates a Relation with Enabled=true.

func (*Relation) Deserialize

func (r *Relation) Deserialize(rdr report.Reader) error

Deserialize reads the relation's properties from rdr.

func (*Relation) Equals

func (r *Relation) Equals(other *Relation) bool

Equals returns true when both relations have the same parent/child data sources and the same column sets.

func (*Relation) Serialize

func (r *Relation) Serialize(w report.Writer) error

Serialize writes the relation's properties to w.

type RelationCollection

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

RelationCollection is an ordered collection of Relation objects. It is the Go equivalent of FastReport.Data.RelationCollection.

func NewRelationCollection

func NewRelationCollection() *RelationCollection

NewRelationCollection creates an empty RelationCollection.

func (*RelationCollection) Add

func (c *RelationCollection) Add(rel *Relation)

Add appends a relation to the collection.

func (*RelationCollection) All

func (c *RelationCollection) All() []*Relation

All returns a copy of the internal slice.

func (*RelationCollection) Count

func (c *RelationCollection) Count() int

Count returns the number of relations.

func (*RelationCollection) FindByAlias

func (c *RelationCollection) FindByAlias(alias string) *Relation

FindByAlias returns the relation with the given alias, or nil if not found.

func (*RelationCollection) FindByName

func (c *RelationCollection) FindByName(name string) *Relation

FindByName returns the relation with the given name, or nil if not found.

func (*RelationCollection) FindEqual

func (c *RelationCollection) FindEqual(rel *Relation) *Relation

FindEqual returns the first relation that is equal to rel, or nil if not found.

func (*RelationCollection) Get

func (c *RelationCollection) Get(i int) *Relation

Get returns the relation at index i.

func (*RelationCollection) Remove

func (c *RelationCollection) Remove(rel *Relation)

Remove removes a relation by reference.

type SortSpec

type SortSpec struct {
	Column     string
	Descending bool
}

SortSpec describes one sort key for SortRows.

type Sortable

type Sortable interface {
	SortRows(specs []SortSpec)
}

Sortable is implemented by data sources that support in-memory row sorting.

type SystemVariables

type SystemVariables struct {
	// PageNumber is the current page number (1-based).
	// Corresponds to C# PageVariable (Name="Page").
	PageNumber int
	// TotalPages is the total number of pages (available after double-pass or report finish).
	// Corresponds to C# TotalPagesVariable (Name="TotalPages").
	TotalPages int
	// Date is the report run date/time.
	// Corresponds to C# DateVariable (Name="Date").
	Date time.Time
	// Time is the report run time (same instant as Date).
	Time time.Time
	// Row is the current data row number within the current band (1-based).
	// Corresponds to C# RowVariable (Name="Row#").
	Row int
	// AbsRow is the absolute row number across all groups (1-based).
	// Corresponds to C# AbsRowVariable (Name="AbsRow#").
	AbsRow int
	// HierarchyLevel is the nesting level in a hierarchical data band.
	// Corresponds to C# HierarchyLevelVariable (Name="HierarchyLevel").
	HierarchyLevel int
	// HierarchyRow is the dot-separated row identifier in hierarchical reports (e.g. "1.2.3").
	// Corresponds to C# HierarchyRowNoVariable (Name="HierarchyRow#").
	HierarchyRow string
}

SystemVariables holds the built-in engine variables updated during report preparation. It is the Go equivalent of FastReport.Data.SystemVariables. C# ref: FastReport.Data.SystemVariables (SystemVariables.cs)

func NewSystemVariables

func NewSystemVariables() *SystemVariables

NewSystemVariables creates a SystemVariables initialised to the current time.

func (*SystemVariables) Get

func (sv *SystemVariables) Get(name string) any

Get returns the value of the named system variable. Accepts both the canonical C# names and the Go alias names. Returns nil when the name is not recognised.

func (*SystemVariables) Set

func (sv *SystemVariables) Set(name string, value any)

Set updates a system variable by name. Accepts both the canonical C# names and the Go alias names. Unknown names are ignored.

func (*SystemVariables) ToParameters

func (sv *SystemVariables) ToParameters() []*Parameter

ToParameters converts the system variables to a []*Parameter slice suitable for use as Dictionary.SystemVariables(). The returned slice includes both the canonical C# names ("Page", "Row#", etc.) and the Go-idiomatic aliases ("PageNumber", "AbsRow#", etc.) for compatibility.

type TableCollection

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

TableCollection provides ordered access to TableDataSource objects. It is the Go equivalent of FastReport.Data.TableCollection.

func NewTableCollection

func NewTableCollection() *TableCollection

NewTableCollection creates an empty collection.

func (*TableCollection) Add

func (c *TableCollection) Add(t *TableDataSource)

Add appends a table data source to the collection.

func (*TableCollection) All

func (c *TableCollection) All() []*TableDataSource

All returns a copy of the internal slice.

func (*TableCollection) Count

func (c *TableCollection) Count() int

Count returns the number of table data sources.

func (*TableCollection) Get

func (c *TableCollection) Get(i int) *TableDataSource

Get returns the table data source at index i.

func (*TableCollection) Remove

func (c *TableCollection) Remove(t *TableDataSource)

Remove removes a table data source by reference.

func (*TableCollection) Sort

func (c *TableCollection) Sort()

Sort sorts table data sources by their aliases (ascending). C# ref: FastReport.Data.TableCollection.Sort()

type TableDataSource

type TableDataSource struct {
	BaseDataSource
	// contains filtered or unexported fields
}

TableDataSource is a data source backed by a SQL query executed against a DataConnectionBase. It is the Go equivalent of FastReport.Data.TableDataSource.

func NewTableDataSource

func NewTableDataSource(name string) *TableDataSource

NewTableDataSource creates a TableDataSource with the given name. Enabled defaults to true to match DataComponentBase defaults.

func (*TableDataSource) AddParameter

func (t *TableDataSource) AddParameter(p *CommandParameter)

AddParameter appends a command parameter.

func (*TableDataSource) Connection

func (t *TableDataSource) Connection() *DataConnectionBase

Connection returns the owning DataConnectionBase. When IgnoreConnection is true, Connection returns nil (matching C# behaviour).

func (*TableDataSource) Deserialize

func (t *TableDataSource) Deserialize(r report.Reader) error

Deserialize reads the TableDataSource properties from r. C# ref: FastReport.Data.TableDataSource.Deserialize (implicit via FRX reader)

func (*TableDataSource) Enabled

func (t *TableDataSource) Enabled() bool

Enabled returns whether this table data source is active. C# ref: FastReport.Data.DataComponentBase.Enabled

func (*TableDataSource) ForceLoadData

func (t *TableDataSource) ForceLoadData() bool

ForceLoadData returns whether data is force-reloaded even if already cached. C# ref: FastReport.Data.DataSourceBase.ForceLoadData

func (*TableDataSource) IgnoreConnection

func (t *TableDataSource) IgnoreConnection() bool

IgnoreConnection returns whether the data source ignores its connection and uses externally-provided data instead of querying the database. C# ref: FastReport.Data.TableDataSource.IgnoreConnection

func (*TableDataSource) Init

func (t *TableDataSource) Init() error

Init executes the SELECT command and loads results into the in-memory row store. When ignoreConnection is true, Init returns nil immediately (data was provided externally). When storeData is true and data is already loaded (initialized is true and forceLoadData is false), Init skips re-querying.

func (*TableDataSource) InitSchema

func (t *TableDataSource) InitSchema() error

InitSchema discovers the table schema without loading data. It executes the select command (or a SELECT * FROM tableName) wrapped in a LIMIT 0 subquery to obtain column metadata, and populates t.columns. C# ref: FastReport.Data.TableDataSource.InitSchema()

func (*TableDataSource) LoadData

func (t *TableDataSource) LoadData() error

LoadData loads data into the data source. It delegates to Init(). C# ref: FastReport.Data.TableDataSource.LoadData()

func (*TableDataSource) Parameters

func (t *TableDataSource) Parameters() []*CommandParameter

Parameters returns the command parameters.

func (*TableDataSource) QbSchema

func (t *TableDataSource) QbSchema() string

QbSchema returns the query-builder schema string (designer use only). C# ref: FastReport.Data.TableDataSource.QbSchema

func (*TableDataSource) RefreshColumns

func (t *TableDataSource) RefreshColumns(enableNew bool)

RefreshColumns synchronises the column list with the current schema obtained from InitSchema. New columns are added (with Enabled = enableNew) and columns no longer present in the schema are removed. Calculated columns are preserved. C# ref: FastReport.Data.TableDataSource.RefreshColumns(bool enableNew)

func (*TableDataSource) RefreshTable

func (t *TableDataSource) RefreshTable() error

RefreshTable reloads the table schema and synchronises the column list. It is equivalent to deleting and re-running InitSchema and then calling RefreshColumns(true) so that newly discovered columns are enabled. C# ref: FastReport.Data.TableDataSource.RefreshTable()

func (*TableDataSource) SelectCommand

func (t *TableDataSource) SelectCommand() string

SelectCommand returns the SQL SELECT statement.

func (*TableDataSource) Serialize

func (t *TableDataSource) Serialize(w report.Writer) error

Serialize writes the TableDataSource properties to w. C# ref: FastReport.Data.TableDataSource.Serialize (implicit via FRX writer)

func (*TableDataSource) SetEnabled

func (t *TableDataSource) SetEnabled(v bool)

SetEnabled enables or disables this table data source.

func (*TableDataSource) SetForceLoadData

func (t *TableDataSource) SetForceLoadData(v bool)

SetForceLoadData sets the force-load-data flag.

func (*TableDataSource) SetIgnoreConnection

func (t *TableDataSource) SetIgnoreConnection(v bool)

SetIgnoreConnection sets the ignore-connection flag.

func (*TableDataSource) SetQbSchema

func (t *TableDataSource) SetQbSchema(s string)

SetQbSchema sets the query-builder schema string.

func (*TableDataSource) SetSelectCommand

func (t *TableDataSource) SetSelectCommand(s string)

SetSelectCommand sets the SQL SELECT statement.

func (*TableDataSource) SetStoreData

func (t *TableDataSource) SetStoreData(v bool)

SetStoreData sets the store-data flag.

func (*TableDataSource) SetTableName

func (t *TableDataSource) SetTableName(s string)

SetTableName sets the table name.

func (*TableDataSource) StoreData

func (t *TableDataSource) StoreData() bool

StoreData returns whether query results are cached for replay.

func (*TableDataSource) TableName

func (t *TableDataSource) TableName() string

TableName returns the source table or view name.

type Total

type Total struct {
	// Name is the total's unique name.
	Name string
	// Value is the computed aggregate value (set at report run time).
	Value any
	// Expression is the value expression evaluated per row (empty for Count).
	Expression string
	// TotalType is the aggregate function (Sum, Min, Max, Avg, Count, etc.).
	TotalType TotalType
	// Evaluator is the name of the DataBand that drives this total.
	Evaluator string
	// PrintOn is the name of the band where the total is printed/reset.
	PrintOn string
	// ResetAfterPrint resets the total after it is printed.
	// C# default: false.
	ResetAfterPrint bool
	// ResetOnReprint controls whether the total resets when a band is reprinted.
	// C# default: true (serialized only when false).
	ResetOnReprint bool
	// EvaluateCondition is an optional filter expression applied per row.
	EvaluateCondition string
	// IncludeInvisibleRows includes hidden rows in the aggregate.
	// C# default: false.
	IncludeInvisibleRows bool
}

Total represents an aggregate calculation over a data band. It is the Go equivalent of FastReport.Data.Total.

type TotalCollection

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

TotalCollection manages a set of Total objects used during report execution. It is the Go equivalent of FastReport.Data.TotalCollection.

func NewTotalCollection

func NewTotalCollection() *TotalCollection

NewTotalCollection creates an empty collection.

func (*TotalCollection) Add

func (c *TotalCollection) Add(t *Total)

Add appends a total to the collection.

func (*TotalCollection) All

func (c *TotalCollection) All() []*Total

All returns a copy of the internal slice.

func (*TotalCollection) ClearValues

func (c *TotalCollection) ClearValues()

ClearValues resets the accumulated Value on all totals in the collection. C# ref: FastReport.Data.TotalCollection.ClearValues (internal)

func (*TotalCollection) Contains

func (c *TotalCollection) Contains(t *Total) bool

Contains reports whether the given Total pointer is already in the collection. C# ref: FastReport.Data.TotalCollection.Contains (via FRCollectionBase)

func (*TotalCollection) Count

func (c *TotalCollection) Count() int

Count returns the number of totals.

func (*TotalCollection) CreateUniqueName

func (c *TotalCollection) CreateUniqueName(name string) string

CreateUniqueName returns a unique total name derived from name by appending an incrementing integer suffix until no collision is found. C# ref: FastReport.Data.TotalCollection.CreateUniqueName

func (*TotalCollection) FindByName

func (c *TotalCollection) FindByName(name string) *Total

FindByName returns the first total whose name matches (case-insensitive), or nil if not found. C# ref: FastReport.Data.TotalCollection.FindByName

func (*TotalCollection) Get

func (c *TotalCollection) Get(i int) *Total

Get returns the total at index i.

func (*TotalCollection) GetValue

func (c *TotalCollection) GetValue(name string) (any, error)

GetValue returns the current value of the named total. Returns an error when the total is not found. C# ref: FastReport.Data.TotalCollection.GetValue (internal)

func (*TotalCollection) Remove

func (c *TotalCollection) Remove(t *Total)

Remove removes a total by reference.

type TotalEngine

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

TotalEngine manages a set of AggregateTotals and accumulates values during report execution. It acts as the runtime registry for AggregateTotal instances and is the Go equivalent of FastReport's runtime total collection.

func NewTotalEngine

func NewTotalEngine() *TotalEngine

NewTotalEngine creates a new, empty TotalEngine.

func (*TotalEngine) Accumulate

func (te *TotalEngine) Accumulate(name string, value any) error

Accumulate adds value to the named total. Returns an error when the total is not registered or value cannot be accumulated (e.g. non-numeric value for a Sum total).

func (*TotalEngine) All

func (te *TotalEngine) All() []*AggregateTotal

All returns all registered AggregateTotal objects in registration order.

func (*TotalEngine) Find

func (te *TotalEngine) Find(name string) *AggregateTotal

Find returns the AggregateTotal with the given name, or nil if not found.

func (*TotalEngine) Len

func (te *TotalEngine) Len() int

Len returns the number of registered totals.

func (*TotalEngine) Register

func (te *TotalEngine) Register(t *AggregateTotal)

Register adds an AggregateTotal to the engine. If a total with the same name already exists, it is replaced.

func (*TotalEngine) Reset

func (te *TotalEngine) Reset(name string) error

Reset resets the named total to its zero state. Returns an error when the total is not registered.

func (*TotalEngine) ResetAll

func (te *TotalEngine) ResetAll()

ResetAll resets every registered total.

func (*TotalEngine) Value

func (te *TotalEngine) Value(name string) any

Value returns the current computed aggregate value for the named total. Returns nil when the total is not registered.

type TotalType

type TotalType int

TotalType identifies the aggregate function a Total computes.

const (
	// TotalTypeSum computes the sum of values.
	TotalTypeSum TotalType = iota
	// TotalTypeMin computes the minimum value.
	TotalTypeMin
	// TotalTypeMax computes the maximum value.
	TotalTypeMax
	// TotalTypeAvg computes the average value.
	TotalTypeAvg
	// TotalTypeCount counts non-nil values.
	TotalTypeCount
	// TotalTypeCountDistinct counts distinct non-nil values.
	TotalTypeCountDistinct
)

type ViewDataSource

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

ViewDataSource wraps a base DataSource and exposes only rows that satisfy a filter expression. The filter is evaluated lazily using a user-supplied ExprEvaluator so that [bracket] expressions can reference column values.

It is the Go equivalent of FastReport.Data.ViewDataSource. C# ref: FastReport.Base/Data/ViewDataSource.cs

func NewViewDataSource

func NewViewDataSource(inner DataSource, name, alias, filter string, eval ViewExprEvaluator) *ViewDataSource

NewViewDataSource creates a ViewDataSource wrapping inner.

  • name / alias identify the view in the dictionary.
  • filter is a boolean expression (may be empty string = no filter).
  • eval is called to evaluate filter; pass nil to use a simple "always true" evaluator.

func (*ViewDataSource) Alias

func (v *ViewDataSource) Alias() string

func (*ViewDataSource) Close

func (v *ViewDataSource) Close() error

Close closes the inner data source.

func (*ViewDataSource) Columns

func (v *ViewDataSource) Columns() []Column

Columns returns the column list for this view. If no columns have been loaded yet, InitSchema is called first. C# ref: FastReport.Data.ViewDataSource.CreateColumns / InitSchema

func (*ViewDataSource) CurrentRowNo

func (v *ViewDataSource) CurrentRowNo() int

CurrentRowNo returns the 0-based index within the filtered row set.

func (*ViewDataSource) EOF

func (v *ViewDataSource) EOF() bool

EOF returns true when all filtered rows have been consumed.

func (*ViewDataSource) Filter

func (v *ViewDataSource) Filter() string

Filter returns the filter expression.

func (*ViewDataSource) First

func (v *ViewDataSource) First() error

First resets the cursor to before the first row.

func (*ViewDataSource) ForceLoadData

func (v *ViewDataSource) ForceLoadData() bool

ForceLoadData returns whether data is force-reloaded on every Init call. C# ref: FastReport.Data.DataSourceBase.ForceLoadData

func (*ViewDataSource) GetValue

func (v *ViewDataSource) GetValue(column string) (any, error)

GetValue delegates to the inner data source at the current row.

func (*ViewDataSource) Init

func (v *ViewDataSource) Init() error

Init initializes the inner data source and pre-builds the filtered row index. When ForceLoadData is true the index is always rebuilt. C# ref: FastReport.Data.ViewDataSource.LoadData (via DataSourceBase.Init)

func (*ViewDataSource) InitSchema

func (v *ViewDataSource) InitSchema()

InitSchema initializes the column list from the inner data source if it exposes columns and the current column list is empty. It also resets the column-index cache so subsequent GetValue calls use fresh indices. C# ref: FastReport.Data.ViewDataSource.InitSchema()

func (*ViewDataSource) Inner

func (v *ViewDataSource) Inner() DataSource

Inner returns the underlying DataSource that this ViewDataSource wraps. C# ref: FastReport.Data.ViewDataSource.View property (analogous)

func (*ViewDataSource) Name

func (v *ViewDataSource) Name() string

func (*ViewDataSource) Next

func (v *ViewDataSource) Next() error

Next advances to the next matching row.

func (*ViewDataSource) RefreshColumns

func (v *ViewDataSource) RefreshColumns()

RefreshColumns synchronises the column list with the inner data source: new columns are added and columns no longer present in the inner source are removed. Calculated columns (those without a matching inner column) are preserved. C# ref: FastReport.Data.ViewDataSource.RefreshColumns()

func (*ViewDataSource) RowCount

func (v *ViewDataSource) RowCount() int

RowCount returns the number of rows that pass the filter.

func (*ViewDataSource) SetAlias

func (v *ViewDataSource) SetAlias(alias string)

SetAlias sets the human-friendly alias.

func (*ViewDataSource) SetFilter

func (v *ViewDataSource) SetFilter(expr string)

SetFilter updates the filter expression and invalidates the pre-built index.

func (*ViewDataSource) SetForceLoadData

func (v *ViewDataSource) SetForceLoadData(val bool)

SetForceLoadData sets the force-load-data flag. When true, the row index is rebuilt on every Init call regardless of cache. C# ref: FastReport.Data.DataSourceBase.ForceLoadData

func (*ViewDataSource) SetName

func (v *ViewDataSource) SetName(name string)

SetName sets the internal name. When alias was previously equal to name (case-insensitively) or empty, it is kept in sync with the new name. Mirrors C# DataComponentBase.SetName alias-sync behavior.

type ViewExprEvaluator

type ViewExprEvaluator func(expr string, src DataSource) (bool, error)

ViewExprEvaluator evaluates a filter expression in the context of the current row. It is called once per row during Init/First to pre-build the index. The evaluator receives the DataSource positioned at the row to test. Return (true, nil) to include the row, (false, nil) to exclude it.

type VirtualDataSource

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

VirtualDataSource is a data source that produces a fixed number of rows with no actual column data. It is the Go equivalent of FastReport.Data.VirtualDataSource.

Use it when a band needs to iterate N times and values are computed by report expressions (not read from a real data source). Each row is an empty position — all GetValue calls return nil.

Example:

ds := data.NewVirtualDataSource("MyVirtual", 10)
dict.RegisterData(ds, "MyVirtual")

func NewVirtualDataSource

func NewVirtualDataSource(name string, rowCount int) *VirtualDataSource

NewVirtualDataSource creates a VirtualDataSource with the given name that will produce rowCount virtual rows.

func (*VirtualDataSource) Alias

func (ds *VirtualDataSource) Alias() string

Alias returns the human-friendly alias.

func (*VirtualDataSource) Close

func (ds *VirtualDataSource) Close() error

Close is a no-op for a virtual data source.

func (*VirtualDataSource) CurrentRowNo

func (ds *VirtualDataSource) CurrentRowNo() int

CurrentRowNo returns the 0-based index of the current virtual row.

func (*VirtualDataSource) EOF

func (ds *VirtualDataSource) EOF() bool

EOF returns true when all virtual rows have been consumed.

func (*VirtualDataSource) First

func (ds *VirtualDataSource) First() error

First positions at the first virtual row.

func (*VirtualDataSource) GetValue

func (ds *VirtualDataSource) GetValue(column string) (any, error)

GetValue always returns nil — virtual rows carry no real column data. Values are expected to be computed by report expressions.

func (*VirtualDataSource) Init

func (ds *VirtualDataSource) Init() error

Init marks the data source as initialized and resets position.

func (*VirtualDataSource) Name

func (ds *VirtualDataSource) Name() string

Name returns the data source name.

func (*VirtualDataSource) Next

func (ds *VirtualDataSource) Next() error

Next advances to the next virtual row.

func (*VirtualDataSource) RowCount

func (ds *VirtualDataSource) RowCount() int

RowCount returns the total number of virtual rows.

func (*VirtualDataSource) RowsCount

func (ds *VirtualDataSource) RowsCount() int

RowsCount returns the number of virtual rows.

func (*VirtualDataSource) SetAlias

func (ds *VirtualDataSource) SetAlias(a string)

SetAlias sets the display alias.

func (*VirtualDataSource) SetRowsCount

func (ds *VirtualDataSource) SetRowsCount(n int)

SetRowsCount sets the number of virtual rows.

Directories

Path Synopsis
Package csv provides a CSV data source for go-fastreport.
Package csv provides a CSV data source for go-fastreport.
Package json is part of the go-fastreport library, a pure Go port of FastReport .NET.
Package json is part of the go-fastreport library, a pure Go port of FastReport .NET.
Package sql provides SQL database connections for go-fastreport.
Package sql provides SQL database connections for go-fastreport.
Package xml is part of the go-fastreport library, a pure Go port of FastReport .NET.
Package xml is part of the go-fastreport library, a pure Go port of FastReport .NET.

Jump to

Keyboard shortcuts

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