Go struct and validation logic for product catalog plan addons in OpenMeter billing system.
// Source: https://github.com/openmeterio/openmeter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
package addon
import (
"errors"
"github.com/openmeterio/openmeter/openmeter/productcatalog"
"github.com/openmeterio/openmeter/pkg/models"
)
var _ models.Validator = (*Addon)(nil)
// Plan stores the Addon specific representation of planaddon.PlanAddon.
type Plan struct {
models.NamespacedID
models.ManagedModel
productcatalog.PlanAddonMeta
productcatalog.Plan
}
func (p Plan) Validate() error {
var errs []error
if err := p.NamespacedID.Validate(); err != nil {
errs = append(errs, err)
}
if err := p.Plan.Validate(); err != nil {
errs = append(errs, err)
}
retur
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key