comment

package
v1.0.0-alpha.28 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package comment turns FOCUS rows into the check output and the sticky pull request comment.

Everything rendered is a structured field. A string from the pull request reaches a template only as Data.

Index

Constants

View Source
const (
	// Marker opens the sticky comment, which is how the next run finds it.
	Marker = "<!-- costroid:comment -->"
	// CheckName is the one check run's name.
	CheckName = "costroid"
)
View Source
const (
	AccountGitHub = "github"
	AccountGitLab = "gitlab"
)

The hosts an account link can name.

View Source
const ArtifactRefused reason.Reason = "artifact_refused"

ArtifactRefused is the run reason a report states when the action refused the artifact that carried the rows, because it held more than the rows and the run object. Nothing in that artifact is read.

View Source
const Multiple = "multiple"

Multiple is the value of currency, cost_basis or catalog_version when the run's figures hold more than one. The figure outputs are then empty, because figures in two currencies or two bases are never summed.

View Source
const StatusLimit = 255

StatusLimit is the longest a verdict sentence gets, in characters. It is GitLab's limit on a commit status description, the shortest of the fields a host gives such a sentence.

Variables

View Source
var OutputNames = []string{
	"cost", "currency", "cost_basis",
	"tokens_input_uncached", "tokens_cache_read", "tokens_cache_write", "tokens_output",
	"enforcement_grade", "catalog_version", "check_run_id", "conclusion", "result",
}

OutputNames are the action's outputs, in the order it declares them.

Functions

func ApprovedConclusion

func ApprovedConclusion(verdict string, approval *Approval, head string) string

ApprovedConclusion is the conclusion a check gets from the policy's verdict and an approval of its head: neutral for an approved failure, and the verdict otherwise. On rows the agent's job wrote, an approval never concludes success.

func Comment

func Comment(input Input) (string, error)

Comment renders the sticky comment. Its block is a copy of the check's that names the check run, without the amounts unless they are shown.

func CommentWithLifetime

func CommentWithLifetime(input Input, lifetime *Lifetime) (string, error)

CommentWithLifetime renders the sticky comment with the pull request's lifetime after this run's figures. The lifetime is withheld with the amounts, and a nil lifetime renders the comment Comment does.

func FigureCost

func FigureCost(figure BlockFigure) (decimal.Decimal, error)

FigureCost checks one figure of a result object read back from a check run and returns its amount. Any job of the repository can post such a check run, so the currency, the basis and the amount are each checked before they are added up or shown.

func KnownStated

func KnownStated(stated adapter.Stated) bool

KnownStated reports a figure whose agent, unit and quantity result/v0.9 holds together. Any other is dropped, so the object never states it.

func LocalConfig

func LocalConfig(path string) string

LocalConfig names a costroid.yml read from the working tree at path: the default file as the one in this directory, any other by its path.

func Money

func Money(currency, exact string) string

Money draws an amount after its currency code, as every amount a person reads is drawn: in the comment, the check, the job summary and a terminal.

func RequestNoun

func RequestNoun(host string) string

RequestNoun is what a host calls a change proposed for merge: a merge request on GitLab, a pull request on any other host. Only words a person reads take it, in the comment and in the job's log. Keys, tags, flags, rule ids and outputs keep pr and pull_request on every host.

func Result

func Result(input Input) (string, error)

Result renders the result object as the check run carries it: every amount in it, and the check run's id once the check names it.

func Summary

func Summary(input Input) (string, error)

Summary renders the job summary. It opens on the verdict sentence and reads in the comment's order, with each figure's catalog and token counts in its table. Withheld, it shows no amount and no token count.

func VerdictLines

func VerdictLines(input Input, config string) []string

VerdictLines are what a terminal prints above the verdict sentence, one sentence a line: why no rule ran or that none applied, each rule the sentence does not name, and the warn-only period when it holds a rule. config names the costroid.yml the verdict read, as LocalConfig does. The lines carry no link. They are built from the verdict's closed fields and its amounts, so no text from the pull request reaches them.

func VerdictSentence

func VerdictSentence(input Input) string

VerdictSentence says what is true of a run in one sentence of plain text. It is the same string on every surface a person reads: the check's title, the first line of the comment and of the job summary, and the last line a terminal prints. It states what the run is against its policy, the figure with its currency and basis, the budget, and one clause on what was checked or what follows. Withheld, it names no amount and says so.

func WrittenSchemas

func WrittenSchemas() []string

WrittenSchemas are the versions of the result object this release writes, oldest first. A reader of the check runs this release posts reads each.

Types

type Amounts

type Amounts int

Amounts says whether the comment carries amounts, and why not.

const (
	// AmountsUnsettled withholds, because the setting or the visibility could
	// not be read.
	AmountsUnsettled Amounts = iota
	// AmountsOff withholds on a public repository with comment.show_cost false.
	AmountsOff
	// AmountsShown is the default.
	AmountsShown
)

The zero value withholds, so an Input that never set the field cannot publish an amount.

type Approval

type Approval struct {
	// Approver is the reviewer's login, which no App's account can be.
	Approver string
	HeadSHA  string
	At       time.Time
}

Approval is a review that approved one commit, as the host stated it.

type Block

type Block struct {
	Schema      string        `json:"schema"`
	CheckRunID  *int64        `json:"check_run_id,omitempty"`
	Conclusion  *string       `json:"conclusion"`
	State       State         `json:"state"`
	Reason      Reason        `json:"reason,omitempty"`
	ReasonLine  int           `json:"reason_line,omitempty"`
	RunReason   reason.Reason `json:"run_reason,omitempty"`
	ReaderError string        `json:"reader_error,omitempty"`
	// AgentError is the class of error the agent ended with, null when the
	// run stated none.
	AgentError *BlockAgentError `json:"agent_error"`
	// AgentSkipped says whether the CI system skipped the agent's job, null
	// when the report was not told.
	AgentSkipped *bool  `json:"agent_skipped"`
	HeadSHA      string `json:"head_sha"`
	// CIRun is the run the environment names, a claim, null when it names
	// none.
	CIRun *BlockCIRun `json:"ci_run"`
	// RowsSHA256 and RowsFileSHA256 name the rows and the rows file the
	// figures were built from, null when not stated. RowsSHA256 is null
	// without figures.
	RowsSHA256     *string       `json:"rows_sha256"`
	RowsFileSHA256 *string       `json:"rows_file_sha256"`
	Amounts        string        `json:"amounts"`
	Rows           int           `json:"rows"`
	RunIdentity    string        `json:"run_identity"`
	Figures        []BlockFigure `json:"figures"`
	FiguresOmitted int           `json:"figures_omitted"`
	Cap            *BlockCap     `json:"cap"`
	Data           BlockData     `json:"data"`
	// Lifetime is the pull request's total as the comment states it, null
	// off a pull request and when amounts are withheld.
	Lifetime *BlockLifetime `json:"lifetime"`
	// AgentStated is the agent's own figure for the run, in its own unit,
	// null when it states none and when amounts are withheld.
	AgentStated *BlockAgentStated `json:"agent_stated"`
	// Recorded names the recorded run whose rows the figures are, in place of
	// the pull request's own, null on a report on the pull request's rows.
	// A withheld copy states it too: it is no amount.
	Recorded *BlockRecorded `json:"recorded"`
	// Estimates are the figures of the rows that are not an agent's, and an
	// estimate the workflow named that was not available. They stand apart
	// from Figures and are never added to them. EstimatesOmitted counts the
	// figures left out past the first maxFigures. A result/0.9 object holds
	// neither.
	Estimates        []BlockEstimate `json:"estimates"`
	EstimatesOmitted int             `json:"estimates_omitted"`
	// Policy is the verdict, without its amounts when amounts are withheld.
	Policy *policy.Verdict `json:"policy,omitempty"`
}

Block is the result object, the machine-readable block. Strings under Data originate in the pull request.

func ParseResult

func ParseResult(text string) (Block, error)

ParseResult reads the fenced result object a check run's text carries. It takes an object of a version in readSchemas, and only one a release that writes that version would write byte for byte, so a check that repeats it changes nothing it does not mean to.

func (Block) ApprovedConclusion

func (b Block) ApprovedConclusion(approval *Approval) string

ApprovedConclusion is the conclusion the check that repeats this object gets with the approval, nil for none.

type BlockAgentError

type BlockAgentError struct {
	Class string `json:"class"`
}

BlockAgentError names an agent's error by its class from a closed list, never by the agent's own text.

type BlockAgentStated

type BlockAgentStated struct {
	Unit     string `json:"unit"`
	Quantity string `json:"quantity"`
	Source   string `json:"source"`
}

BlockAgentStated is a figure the agent stated about its own run, in its own unit. Costroid never converts it and never adds it to an amount.

type BlockCIRun

type BlockCIRun struct {
	ID      int64 `json:"id"`
	Attempt int   `json:"attempt"`
}

BlockCIRun is GitHub Actions' run id and attempt as the environment states them.

type BlockCap

type BlockCap struct {
	Currency         string  `json:"currency"`
	Amount           string  `json:"amount"`
	EnforcementGrade *string `json:"enforcement_grade"`
	Cost             *string `json:"cost"`
	CostBasis        *string `json:"cost_basis"`
	Remainder        *string `json:"remainder"`
	Overshoot        *string `json:"overshoot"`
	OvershootTokens  *string `json:"overshoot_tokens"`
}

BlockCap is the run's cap beside the figure it holds. The fields after EnforcementGrade are null when no single figure compares with it.

type BlockData

type BlockData struct {
	Agents        []Data `json:"agents"`
	Models        []Data `json:"models"`
	ModelsOmitted int    `json:"models_omitted"`
	Catalogs      []Data `json:"catalog_versions"`
	// FallbackModels and FallbackPrices name the rows priced at the catalog's
	// fallback tier.
	FallbackModels        []Data `json:"fallback_models"`
	FallbackModelsOmitted int    `json:"fallback_models_omitted"`
	FallbackPrices        []Data `json:"fallback_price_ids"`
	FallbackPricesOmitted int    `json:"fallback_price_ids_omitted"`
}

BlockData holds the strings that originated in the pull request, labelled as data. Each one passed the allowlist.

type BlockEstimate

type BlockEstimate struct {
	Source            Data   `json:"source"`
	Currency          string `json:"currency,omitempty"`
	ChargePeriodStart string `json:"charge_period_start,omitempty"`
	ChargePeriodEnd   string `json:"charge_period_end,omitempty"`
	CostBasis         string `json:"cost_basis,omitempty"`
	ListCost          string `json:"list_cost,omitempty"`
	Rows              int    `json:"rows,omitempty"`
	Reason            string `json:"reason,omitempty"`
}

BlockEstimate is one entry of a result/0.10 object's estimates. A figure names its source, currency, charge period, basis and rows, and its amount when amounts are shown. An estimate that was not available names its source and Reason alone.

type BlockFigure

type BlockFigure struct {
	Currency         string            `json:"currency"`
	ListCost         string            `json:"list_cost,omitempty"`
	CostBasis        string            `json:"cost_basis"`
	AttributionGrade string            `json:"attribution_grade"`
	EnforcementGrade string            `json:"enforcement_grade"`
	Rows             int               `json:"rows"`
	FallbackRows     int               `json:"fallback_rows"`
	Tokens           map[string]string `json:"tokens,omitempty"`
}

BlockFigure is one Figure. ListCost and Tokens are empty when amounts are withheld.

type BlockLifetime

type BlockLifetime struct {
	Figures        []BlockLifetimeFigure `json:"figures"`
	FiguresOmitted int                   `json:"figures_omitted"`
	Capped         bool                  `json:"capped"`
	Unread         int                   `json:"unread"`
}

BlockLifetime is the pull request's total, one figure per currency and basis, as the comment's lines state it.

type BlockLifetimeFigure

type BlockLifetimeFigure struct {
	Currency  string `json:"currency"`
	CostBasis string `json:"cost_basis"`
	ListCost  string `json:"list_cost"`
	Reports   int    `json:"reports"`
	MayRepeat bool   `json:"may_repeat"`
}

BlockLifetimeFigure is one line of the pull request's total. MayRepeat says the line reads "which may include a repeated report".

type BlockRecorded

type BlockRecorded struct {
	RunID int64  `json:"run_id"`
	Date  string `json:"date"`
}

BlockRecorded is the recorded run a report's figures are: the CI run that wrote its rows and the day it was recorded.

type CheckOutput

type CheckOutput struct {
	Title   string
	Summary string
	Text    string
}

CheckOutput is the output of the check run.

func Check

func Check(input Input) (CheckOutput, error)

Check renders the check output. The title is the verdict sentence, and the summary opens on it. Text carries the result object, with every amount in it whatever the comment shows.

func Reconclude

func Reconclude(block Block, approval *Approval, amounts Amounts, previous int64) (CheckOutput, error)

Reconclude renders a check that repeats an earlier check run's result object with the conclusion an approval gives it: neutral for an approved failure, the policy's verdict when no approval counts. previous names the check run that carries the report in full. The object does not say whether the report's comment shows amounts, so amounts says it, as the report decides it. Unless it reads AmountsShown, the title and the summary name none.

type Config

type Config struct {
	ShowCost bool
}

Config is what the comment reads from costroid.yml.

func ParseConfig

func ParseConfig(data []byte) (Config, error)

ParseConfig reads costroid.yml. A file that is empty, ~, null or only ---, a section with no value, or an absent key leaves the default. A key the comment does not read is named on stderr and never fails the read.

type Data

type Data string

Data is a string that originated in the pull request. Clean is the only way to make one from untrusted text, and the allowlist holds no character that can close a code span, open a tag or start a mention.

func Clean

func Clean(text string) Data

Clean returns text when it passes the allowlist and the length cap.

func (Data) Code

func (d Data) Code() string

Code renders the string as a Markdown code span, so it never renders as Markdown or HTML.

type Figure

type Figure struct {
	Currency    string
	Basis       string
	Attribution string
	Enforcement string
	Cost        decimal.Decimal
	Rows        int
	// FallbackRows counts the rows the catalog priced at its fallback tier.
	FallbackRows int
	// Trace is the arithmetic behind Cost, one line per catalog, class and
	// price. TraceOmitted counts the lines left out of it.
	Trace        []Trace
	TraceOmitted int
	// Tokens is every token count of the figure by class, with no cap.
	Tokens map[focus.TokenClass]decimal.Decimal
	// Catalogs are the catalog versions of the figure's rows.
	Catalogs []Data
	// ProxyCap is the AI-credit cap gh-aw's proxy held the run to, as every
	// row of the figure states it, empty when one states none or another.
	ProxyCap string
	// Subscription is true when every row of the figure notes a run that
	// proved a subscription login.
	Subscription bool
}

Figure is the exact sum of ListCost over rows that share a currency, a basis and both grades. No figure spans two currencies.

type Infrastructure

type Infrastructure struct {
	Figures        []InfrastructureFigure
	FiguresOmitted int
	Rows           []InfrastructureRow
	RowsOmitted    int
}

Infrastructure is what the rows that are not an agent's say: the figures, each the exact sum of ListCost over the rows that share a currency, a basis, a source and a charge period, and the first rows themselves. No figure spans two currencies or two periods, and none is added to an agent's figure.

type InfrastructureFigure

type InfrastructureFigure struct {
	Currency string
	Basis    string
	Source   Data
	Period   Period
	Cost     decimal.Decimal
	Rows     int
}

InfrastructureFigure is one currency, basis, source and period's sum.

type InfrastructureRow

type InfrastructureRow struct {
	Resource Data
	Service  Data
	Currency string
	Period   Period
	Cost     decimal.Decimal
}

InfrastructureRow is one row: what the figure is for, the period it covers and its amount.

type Input

type Input struct {
	Ledger  Ledger
	State   State
	HeadSHA string
	// Budget is the run's cap in USD, nil when the report was not told.
	// Rows record the enforcement grade and do not record the cap. The
	// policy's budget is a separate amount, read from costroid.yml.
	Budget *decimal.Decimal
	// Installation is the SCM installation id, empty when no App is installed.
	// On GitLab it is the project's namespace id.
	Installation string
	// AccountHost is the host the installation id belongs to, GitHub when
	// empty. It is a name, never an instance's address.
	AccountHost string
	// Platform is Costroid Platform's https origin, empty when the report was
	// given none. Repository is the checked repository in the form of the
	// costroid/repo tag, and PullRequest its number, 0 off a pull request.
	// With all three the account link opens the pull request there.
	Platform    string
	Repository  string
	PullRequest int
	// CheckRunID names the posted check, nil when the post failed.
	CheckRunID *int64
	// IDInCheck says the check run's own text names CheckRunID. The id exists
	// only once the check is created, so the report writes it in a second
	// request, and the result object names it once that request succeeds.
	IDInCheck bool
	Amounts   Amounts
	// Preview marks the comment costroid report --preview prints. Its verdict
	// read costroid.yml in the working directory, and a run nothing held
	// says how its cost compares with the cap it was given.
	Preview bool
	// Reason says why there are no figures, and ReasonLine names the line of
	// an InvalidRow.
	Reason     Reason
	ReasonLine int
	// RunReason is why the run wrote no rows, as the run stated it. It is
	// shown only when the rows file holds no rows.
	RunReason reason.Reason
	// ReaderLine is the reader's first error line, shown only with the run
	// reason reader_refused, and cleaned again before it is.
	ReaderLine string
	// AgentError is the class of error the agent ended in, as the run stated
	// it. A class outside the closed list is dropped.
	AgentError adapter.AgentError
	// AgentSkipped says whether the CI system skipped the agent's job, nil
	// when the report was not told. The reason agent_skipped says it too.
	AgentSkipped *bool
	// CIRun is the CI run as the environment states it, nil when it states
	// none. A run whose id or attempt is below 1 is dropped.
	CIRun *BlockCIRun
	// RowsSHA256 is the digest of the rows' x_CostroidRowId values, sorted,
	// and RowsFileSHA256 the digest of the rows file's bytes, each as the
	// report read them. Empty when not stated; a value that is not a digest
	// is dropped.
	RowsSHA256     string
	RowsFileSHA256 string
	// Lifetime is the pull request's total, nil off a pull request. It is
	// withheld with the amounts.
	Lifetime *Lifetime
	// AgentStated is the agent's own figure for the run, in its own unit, nil
	// when it states none. It is shown on a line of its own, never added to
	// an amount, and withheld with the amounts. A unit or a source outside the
	// closed lists is dropped.
	AgentStated *adapter.Stated
	// RunURL is the CI run's page as the environment names it, empty when it
	// names none. A value outside runURLPattern is dropped.
	RunURL string
	// BeforeCheck marks the object costroid run prints, which no check has
	// concluded yet, so its conclusion is null.
	BeforeCheck bool
	// Reconciliations are the last reconciliation of each credential, shown
	// under the budget when present.
	Reconciliations []Reconciliation
	// Verdict is the policy's, nil when no policy ran.
	Verdict *policy.Verdict
	// Approval is a review that approved the head, nil when none counts. It
	// turns a failed verdict's check neutral, and only on HeadSHA.
	Approval *Approval
	// Refused is the artifact the action refused, nil when it took the
	// artifact or fetched none. A refusal fails the check whatever the
	// policy or an approval says, and only on a report with no figures.
	Refused *RefusedArtifact
	// Recorded names the recorded run whose rows the report shows in place
	// of the pull request's own, nil for a report on the pull request's own
	// rows. One that names no run or no calendar date is dropped.
	Recorded *Recorded
	// EstimateUnavailable is the note ingest-run --optional left beside the
	// rows when the estimate it was given was not there, nil when it left
	// none. Its reason is from a closed list. The machine block states it
	// among its estimates.
	EstimateUnavailable *focusfile.Unavailable
	// contains filtered or unexported fields
}

Input is everything a render reads.

func (Input) Conclusion

func (i Input) Conclusion() string

Conclusion is the check's conclusion: failure when the action refused the artifact, the verdict's, neutral when no policy ran, and neutral when an approval binds a failed verdict's head.

func (Input) OnForkRows

func (i Input) OnForkRows() Input

OnForkRows is the input of a report on rows a fork's own workflow run wrote. The recipes run no agent on a fork's pull request, so those rows are the fork's own claim: they neither block a merge nor pass a budget. A verdict that concludes otherwise is held at neutral. A rule the rows break reads as held whether it fails or the warn-only period holds it, because a fork's check stays neutral after the period too.

type Ledger

type Ledger struct {
	Rows           int
	Figures        []Figure
	FiguresOmitted int
	Agents         []Data
	Models         []Data
	ModelsOmitted  int
	Catalogs       []Data
	// FallbackModels are the models of the rows priced at the fallback tier,
	// FallbackPrices the price ids that priced them and FallbackCatalogs the
	// catalogs those rows name.
	FallbackModels        []Data
	FallbackModelsOmitted int
	FallbackPrices        []Data
	FallbackPricesOmitted int
	FallbackCatalogs      []Data
	// Infrastructure is what the rows that are not an agent's say. Rows and
	// every field above count an agent's rows alone.
	Infrastructure Infrastructure
	// contains filtered or unexported fields
}

Ledger is what a rows file says, reduced to the fields the comment shows.

func ReadRows

func ReadRows(source io.Reader) (Ledger, error)

ReadRows reads FOCUS rows as JSON lines. One bad row refuses the file: a partial total would read as a smaller cost. A line at fault comes back as a RowError. A row that is not an agent's, as policy.FromAgent tells, is read into Ledger.Infrastructure and into no agent's figure.

type Lifetime

type Lifetime struct {
	Figures []LifetimeFigure
	// Capped says the host listed as many commits as it lists, so a later
	// commit can be missing from the figures.
	Capped bool
	// Unread counts the check runs left out because their result object
	// could not be read or added up.
	Unread int
}

Lifetime is what the reports on a pull request's commits add up to, this run's included: one figure per currency and basis, never a sum across them.

type LifetimeFigure

type LifetimeFigure struct {
	Currency string
	Basis    string
	Cost     decimal.Decimal
	// Reports counts the reports in the sum.
	Reports int
	// Undigested says a report in the sum states no digest of its rows, so a
	// second report over the same rows cannot be told apart from a new run.
	Undigested bool
}

LifetimeFigure is the sum of one currency and basis over the reports that carry it.

type Output

type Output struct {
	Name  string
	Value string
}

Output is one output of the action's step.

func Outputs

func Outputs(input Input) ([]Output, error)

Outputs are the step's outputs. They carry the amounts whatever the comment shows, as the rows and the check run's block do. A value is one line.

type Period

type Period struct {
	Start, End time.Time
}

Period is a row's charge period, as the row states it. The end is exclusive.

func (Period) String

func (p Period) String() string

String names the period as briefly as it can be named exactly: a whole UTC month as 2026-12, whole UTC days by their first and last day, and any other span by its two instants.

type Reason

type Reason string

Reason says why a report shows no figures. The list is closed, so a comment never prints an error's text.

const (
	NoRowsFile     Reason = "no_rows_file"
	EmptyRowsFile  Reason = "empty_rows_file"
	NotAFile       Reason = "rows_path_not_a_file"
	UnreadRowsFile Reason = "rows_file_unread"
	InvalidRow     Reason = "invalid_row"
	// ForkNoRows is a fork's pull request whose workflow run left no rows
	// file, as the follow-up finds it. The recipes run no agent there.
	ForkNoRows Reason = "fork_no_rows"
	// AgentSkipped is a pull request whose agent job the CI system skipped,
	// so no agent ran and no rows were written.
	AgentSkipped Reason = "agent_skipped"
)

The reasons. The zero value states only what the State says.

type Reconciliation

type Reconciliation struct {
	// Credential is the row's SubAccountId, a string from the rows.
	Credential Data
	// Day is the UTC day reconciled, as YYYY-MM-DD.
	Day   string
	State state.State
}

Reconciliation is the last reconciliation of one credential's day.

type Recorded

type Recorded struct {
	// RunID is the CI run that wrote the rows, from 1.
	RunID int64
	// Date is the day the run was recorded, as YYYY-MM-DD.
	Date string
}

Recorded is a run recorded earlier, as costroid report --recorded names it.

type RefusedArtifact

type RefusedArtifact struct {
	// Count is how many entries it held besides those two files.
	Count int
	// Entries names the first of them, as the action printed them.
	Entries []string
}

RefusedArtifact is what an artifact the action refused held besides the rows and the run object. The agent's job chose every name in it.

type RowError

type RowError struct {
	Line int
	Err  error
}

RowError names the first line of a rows file that is not a valid row.

func (*RowError) Error

func (e *RowError) Error() string

func (*RowError) Unwrap

func (e *RowError) Unwrap() error

type State

type State string

State says what the rows file gave the report.

const (
	Reported   State = "reported"
	NoRows     State = "no_rows"
	Unreadable State = "rows_unreadable"
)

The three states. An unreadable file is never shown as a zero.

type Trace

type Trace struct {
	Catalog   Data
	Class     focus.TokenClass
	PriceID   Data
	UnitPrice decimal.Decimal
	// Unit is a count of tokens, or informationalUnit for a class that carries
	// no price. Both forms are checked, so Unit is never free text.
	Unit   string
	Tokens decimal.Decimal
	Cost   decimal.Decimal
}

Trace is the rows of one Figure that share a catalog, a token class and a price. Cost is UnitPrice times Tokens over the size of Unit, exactly.

Jump to

Keyboard shortcuts

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