schema

package
v1.0.0-beta.211 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BillingDiscountsValueScanner      = entutils.JSONStringValueScanner[*billing.Discounts]()
	BillingDiscountReasonValueScanner = entutils.JSONStringValueScanner[*billing.DiscountReason]()
)
View Source
var AnnotationsValueScanner = field.ValueScannerFunc[models.Annotations, *sql.NullString]{
	V: func(annotations models.Annotations) (driver.Value, error) {
		b, err := json.Marshal(annotations)
		if err != nil {
			return nil, err
		}

		return string(b), nil
	},
	S: func(ns *sql.NullString) (models.Annotations, error) {
		var annotations models.Annotations
		if ns == nil || !ns.Valid {
			return annotations, nil
		}

		if err := json.Unmarshal([]byte(ns.String), &annotations); err != nil {
			return nil, err
		}

		return annotations, nil
	},
}
View Source
var ChannelConfigValueScanner = field.ValueScannerFunc[notification.ChannelConfig, *sql.NullString]{
	V: func(config notification.ChannelConfig) (driver.Value, error) {
		switch config.Type {
		case notification.ChannelTypeWebhook:
			serde := channelConfigSerde[notification.WebHookChannelConfig]{
				ChannelConfigMeta: notification.ChannelConfigMeta{
					Type: config.Type,
				},
				Data: config.WebHook,
			}
			return json.Marshal(serde)
		default:
			return nil, fmt.Errorf("unknown channel type: %s", config.Type)
		}
	},
	S: func(ns *sql.NullString) (notification.ChannelConfig, error) {
		var channelConfig notification.ChannelConfig
		if ns == nil || !ns.Valid {
			return channelConfig, nil
		}

		data := []byte(ns.String)

		var meta notification.ChannelConfigMeta
		if err := json.Unmarshal(data, &meta); err != nil {
			return channelConfig, err
		}

		switch meta.Type {
		case notification.ChannelTypeWebhook:
			serde := channelConfigSerde[notification.WebHookChannelConfig]{
				ChannelConfigMeta: notification.ChannelConfigMeta{
					Type: meta.Type,
				},
				Data: notification.WebHookChannelConfig{},
			}

			if err := json.Unmarshal(data, &serde); err != nil {
				return channelConfig, err
			}

			channelConfig = notification.ChannelConfig{
				ChannelConfigMeta: serde.ChannelConfigMeta,
				WebHook:           serde.Data,
			}

		default:
			return channelConfig, fmt.Errorf("unknown channel type: %s", meta.Type)
		}

		return channelConfig, nil
	},
}
View Source
var RuleConfigValueScanner = field.ValueScannerFunc[notification.RuleConfig, *sql.NullString]{
	V: func(config notification.RuleConfig) (driver.Value, error) {
		switch config.Type {
		case notification.RuleTypeBalanceThreshold:
			serde := ruleConfigSerde[notification.BalanceThresholdRuleConfig]{
				RuleConfigMeta: notification.RuleConfigMeta{
					Type: config.Type,
				},
				Data: config.BalanceThreshold,
			}
			return json.Marshal(serde)
		default:
			return nil, fmt.Errorf("unknown rule config type: %s", config.Type)
		}
	},
	S: func(ns *sql.NullString) (notification.RuleConfig, error) {
		var ruleConfig notification.RuleConfig
		if ns == nil || !ns.Valid {
			return ruleConfig, nil
		}

		data := []byte(ns.String)

		var meta notification.RuleConfigMeta
		if err := json.Unmarshal(data, &meta); err != nil {
			return ruleConfig, err
		}

		switch meta.Type {
		case notification.RuleTypeBalanceThreshold:
			serde := ruleConfigSerde[notification.BalanceThresholdRuleConfig]{
				RuleConfigMeta: notification.RuleConfigMeta{
					Type: meta.Type,
				},
				Data: notification.BalanceThresholdRuleConfig{},
			}

			if err := json.Unmarshal(data, &serde); err != nil {
				return ruleConfig, err
			}

			ruleConfig = notification.RuleConfig{
				RuleConfigMeta:   serde.RuleConfigMeta,
				BalanceThreshold: serde.Data,
			}

		default:
			return ruleConfig, fmt.Errorf("unknown rule type: %s", meta.Type)
		}

		return ruleConfig, nil
	},
}

Functions

This section is empty.

Types

type Addon

type Addon struct {
	ent.Schema
}

func (Addon) Edges

func (Addon) Edges() []ent.Edge

func (Addon) Fields

func (Addon) Fields() []ent.Field

func (Addon) Indexes

func (Addon) Indexes() []ent.Index

func (Addon) Mixin

func (Addon) Mixin() []ent.Mixin

type AddonRateCard

type AddonRateCard struct {
	ent.Schema
}

func (AddonRateCard) Edges

func (AddonRateCard) Edges() []ent.Edge

func (AddonRateCard) Fields

func (AddonRateCard) Fields() []ent.Field

func (AddonRateCard) Indexes

func (AddonRateCard) Indexes() []ent.Index

func (AddonRateCard) Mixin

func (AddonRateCard) Mixin() []ent.Mixin

type AlignmentMixin

type AlignmentMixin struct {
	mixin.Schema
}

AlignmentMixin for Alignment config

func (AlignmentMixin) Fields

func (AlignmentMixin) Fields() []ent.Field

type App

type App struct {
	ent.Schema
}

App stores information about an installed app

func (App) Edges

func (App) Edges() []ent.Edge

func (App) Fields

func (App) Fields() []ent.Field

func (App) Indexes

func (App) Indexes() []ent.Index

func (App) Mixin

func (App) Mixin() []ent.Mixin

type AppCustomInvoicing

type AppCustomInvoicing struct {
	ent.Schema
}

AppCustomInvoicing holds the schema definition for the AppCustomInvoicing entity.

func (AppCustomInvoicing) Edges

func (AppCustomInvoicing) Edges() []ent.Edge

func (AppCustomInvoicing) Fields

func (AppCustomInvoicing) Fields() []ent.Field

func (AppCustomInvoicing) Indexes

func (AppCustomInvoicing) Indexes() []ent.Index

func (AppCustomInvoicing) Mixin

func (AppCustomInvoicing) Mixin() []ent.Mixin

type AppCustomInvoicingCustomer

type AppCustomInvoicingCustomer struct {
	ent.Schema
}

AppCustomInvoicingCustomer holds the schema definition for the AppCustomInvoicingCustomer entity.

func (AppCustomInvoicingCustomer) Edges

func (AppCustomInvoicingCustomer) Fields

func (AppCustomInvoicingCustomer) Indexes

func (AppCustomInvoicingCustomer) Indexes() []ent.Index

func (AppCustomInvoicingCustomer) Mixin

type AppCustomer

type AppCustomer struct {
	ent.Schema
}

AppCustomer holds the schema definition for the AppCustomer entity.

func (AppCustomer) Edges

func (AppCustomer) Edges() []ent.Edge

func (AppCustomer) Fields

func (AppCustomer) Fields() []ent.Field

func (AppCustomer) Indexes

func (AppCustomer) Indexes() []ent.Index

func (AppCustomer) Mixin

func (AppCustomer) Mixin() []ent.Mixin

type AppStripe

type AppStripe struct {
	ent.Schema
}

AppStripe holds the schema definition for the AppStripe entity.

func (AppStripe) Edges

func (AppStripe) Edges() []ent.Edge

func (AppStripe) Fields

func (AppStripe) Fields() []ent.Field

func (AppStripe) Indexes

func (AppStripe) Indexes() []ent.Index

func (AppStripe) Mixin

func (AppStripe) Mixin() []ent.Mixin

type AppStripeCustomer

type AppStripeCustomer struct {
	ent.Schema
}

AppStripeCustomer holds the schema definition for the AppStripeCustomer entity.

func (AppStripeCustomer) Edges

func (AppStripeCustomer) Edges() []ent.Edge

func (AppStripeCustomer) Fields

func (AppStripeCustomer) Fields() []ent.Field

func (AppStripeCustomer) Indexes

func (AppStripeCustomer) Indexes() []ent.Index

func (AppStripeCustomer) Mixin

func (AppStripeCustomer) Mixin() []ent.Mixin

type BalanceSnapshot

type BalanceSnapshot struct {
	ent.Schema
}

func (BalanceSnapshot) Edges

func (BalanceSnapshot) Edges() []ent.Edge

func (BalanceSnapshot) Fields

func (BalanceSnapshot) Fields() []ent.Field

func (BalanceSnapshot) Indexes

func (BalanceSnapshot) Indexes() []ent.Index

func (BalanceSnapshot) Mixin

func (BalanceSnapshot) Mixin() []ent.Mixin

type BillingCustomerLock

type BillingCustomerLock struct {
	ent.Schema
}

func (BillingCustomerLock) Fields

func (BillingCustomerLock) Fields() []ent.Field

func (BillingCustomerLock) Indexes

func (BillingCustomerLock) Indexes() []ent.Index

func (BillingCustomerLock) Mixin

func (BillingCustomerLock) Mixin() []ent.Mixin

type BillingCustomerOverride

type BillingCustomerOverride struct {
	ent.Schema
}

func (BillingCustomerOverride) Edges

func (BillingCustomerOverride) Edges() []ent.Edge

func (BillingCustomerOverride) Fields

func (BillingCustomerOverride) Fields() []ent.Field

func (BillingCustomerOverride) Indexes

func (BillingCustomerOverride) Indexes() []ent.Index

func (BillingCustomerOverride) Mixin

func (BillingCustomerOverride) Mixin() []ent.Mixin

type BillingInvoice

type BillingInvoice struct {
	ent.Schema
}

func (BillingInvoice) Edges

func (BillingInvoice) Edges() []ent.Edge

func (BillingInvoice) Fields

func (BillingInvoice) Fields() []ent.Field

func (BillingInvoice) Indexes

func (BillingInvoice) Indexes() []ent.Index

func (BillingInvoice) Mixin

func (BillingInvoice) Mixin() []ent.Mixin

type BillingInvoiceFlatFeeLineConfig

type BillingInvoiceFlatFeeLineConfig struct {
	ent.Schema
}

func (BillingInvoiceFlatFeeLineConfig) Fields

func (BillingInvoiceFlatFeeLineConfig) Mixin

type BillingInvoiceLine

type BillingInvoiceLine struct {
	ent.Schema
}

func (BillingInvoiceLine) Edges

func (BillingInvoiceLine) Edges() []ent.Edge

func (BillingInvoiceLine) Fields

func (BillingInvoiceLine) Fields() []ent.Field

func (BillingInvoiceLine) Indexes

func (BillingInvoiceLine) Indexes() []ent.Index

func (BillingInvoiceLine) Mixin

func (BillingInvoiceLine) Mixin() []ent.Mixin

type BillingInvoiceLineDiscount

type BillingInvoiceLineDiscount struct {
	ent.Schema
}

TODO[later]: Rename to BillingInvoiceLineUsageDiscount

func (BillingInvoiceLineDiscount) Edges

func (BillingInvoiceLineDiscount) Fields

func (BillingInvoiceLineDiscount) Indexes

func (BillingInvoiceLineDiscount) Indexes() []ent.Index

func (BillingInvoiceLineDiscount) Mixin

type BillingInvoiceLineDiscountBase

type BillingInvoiceLineDiscountBase struct {
	mixin.Schema
}

func (BillingInvoiceLineDiscountBase) Fields

type BillingInvoiceLineUsageDiscount

type BillingInvoiceLineUsageDiscount struct {
	ent.Schema
}

func (BillingInvoiceLineUsageDiscount) Edges

func (BillingInvoiceLineUsageDiscount) Fields

func (BillingInvoiceLineUsageDiscount) Indexes

func (BillingInvoiceLineUsageDiscount) Mixin

type BillingInvoiceUsageBasedLineConfig

type BillingInvoiceUsageBasedLineConfig struct {
	ent.Schema
}

func (BillingInvoiceUsageBasedLineConfig) Fields

func (BillingInvoiceUsageBasedLineConfig) Mixin

type BillingInvoiceValidationIssue

type BillingInvoiceValidationIssue struct {
	ent.Schema
}

func (BillingInvoiceValidationIssue) Edges

func (BillingInvoiceValidationIssue) Fields

func (BillingInvoiceValidationIssue) Indexes

func (BillingInvoiceValidationIssue) Mixin

type BillingProfile

type BillingProfile struct {
	ent.Schema
}

func (BillingProfile) Edges

func (BillingProfile) Edges() []ent.Edge

func (BillingProfile) Fields

func (BillingProfile) Fields() []ent.Field

func (BillingProfile) Indexes

func (BillingProfile) Indexes() []ent.Index

func (BillingProfile) Mixin

func (BillingProfile) Mixin() []ent.Mixin

type BillingSequenceNumbers

type BillingSequenceNumbers struct {
	ent.Schema
}

func (BillingSequenceNumbers) Fields

func (BillingSequenceNumbers) Fields() []ent.Field

func (BillingSequenceNumbers) Indexes

func (BillingSequenceNumbers) Indexes() []ent.Index

func (BillingSequenceNumbers) Mixin

func (BillingSequenceNumbers) Mixin() []ent.Mixin

type BillingWorkflowConfig

type BillingWorkflowConfig struct {
	ent.Schema
}

func (BillingWorkflowConfig) Edges

func (BillingWorkflowConfig) Edges() []ent.Edge

func (BillingWorkflowConfig) Fields

func (BillingWorkflowConfig) Fields() []ent.Field

func (BillingWorkflowConfig) Indexes

func (BillingWorkflowConfig) Indexes() []ent.Index

func (BillingWorkflowConfig) Mixin

func (BillingWorkflowConfig) Mixin() []ent.Mixin

type Customer

type Customer struct {
	ent.Schema
}

Customer stores information about a customer

func (Customer) Edges

func (Customer) Edges() []ent.Edge

func (Customer) Fields

func (Customer) Fields() []ent.Field

func (Customer) Indexes

func (Customer) Indexes() []ent.Index

func (Customer) Mixin

func (Customer) Mixin() []ent.Mixin

type CustomerSubjects

type CustomerSubjects struct {
	ent.Schema
}

CustomerSubject stores the subject keys for a customer

func (CustomerSubjects) Edges

func (CustomerSubjects) Edges() []ent.Edge

func (CustomerSubjects) Fields

func (CustomerSubjects) Fields() []ent.Field

func (CustomerSubjects) Indexes

func (CustomerSubjects) Indexes() []ent.Index

func (CustomerSubjects) Mixin

func (CustomerSubjects) Mixin() []ent.Mixin

type Entitlement

type Entitlement struct {
	ent.Schema
}

func (Entitlement) Edges

func (Entitlement) Edges() []ent.Edge

func (Entitlement) Fields

func (Entitlement) Fields() []ent.Field

func (Entitlement) Indexes

func (Entitlement) Indexes() []ent.Index

func (Entitlement) Mixin

func (Entitlement) Mixin() []ent.Mixin

type Feature

type Feature struct {
	ent.Schema
}

func (Feature) Edges

func (Feature) Edges() []ent.Edge

func (Feature) Fields

func (Feature) Fields() []ent.Field

func (Feature) Indexes

func (Feature) Indexes() []ent.Index

func (Feature) Mixin

func (Feature) Mixin() []ent.Mixin

type Grant

type Grant struct {
	ent.Schema
}

func (Grant) Edges

func (Grant) Edges() []ent.Edge

func (Grant) Fields

func (Grant) Fields() []ent.Field

func (Grant) Indexes

func (Grant) Indexes() []ent.Index

func (Grant) Mixin

func (Grant) Mixin() []ent.Mixin

type Meter

type Meter struct {
	ent.Schema
}

Meter holds the schema definition for the Meter entity.

func (Meter) Edges

func (Meter) Edges() []ent.Edge

Edges of the Meter.

func (Meter) Fields

func (Meter) Fields() []ent.Field

Fields of the Meter.

func (Meter) Indexes

func (Meter) Indexes() []ent.Index

Indexes of the Meter.

func (Meter) Mixin

func (Meter) Mixin() []ent.Mixin

Mixin of the Meter.

type NotificationChannel

type NotificationChannel struct {
	ent.Schema
}

func (NotificationChannel) Edges

func (NotificationChannel) Edges() []ent.Edge

func (NotificationChannel) Fields

func (NotificationChannel) Fields() []ent.Field

func (NotificationChannel) Indexes

func (NotificationChannel) Indexes() []ent.Index

func (NotificationChannel) Mixin

func (NotificationChannel) Mixin() []ent.Mixin

type NotificationEvent

type NotificationEvent struct {
	ent.Schema
}

func (NotificationEvent) Edges

func (NotificationEvent) Edges() []ent.Edge

func (NotificationEvent) Fields

func (NotificationEvent) Fields() []ent.Field

func (NotificationEvent) Indexes

func (NotificationEvent) Indexes() []ent.Index

func (NotificationEvent) Mixin

func (NotificationEvent) Mixin() []ent.Mixin

type NotificationEventDeliveryStatus

type NotificationEventDeliveryStatus struct {
	ent.Schema
}

func (NotificationEventDeliveryStatus) Edges

func (NotificationEventDeliveryStatus) Fields

func (NotificationEventDeliveryStatus) Indexes

func (NotificationEventDeliveryStatus) Mixin

type NotificationRule

type NotificationRule struct {
	ent.Schema
}

func (NotificationRule) Edges

func (NotificationRule) Edges() []ent.Edge

func (NotificationRule) Fields

func (NotificationRule) Fields() []ent.Field

func (NotificationRule) Indexes

func (NotificationRule) Indexes() []ent.Index

func (NotificationRule) Mixin

func (NotificationRule) Mixin() []ent.Mixin

type Plan

type Plan struct {
	ent.Schema
}

func (Plan) Edges

func (Plan) Edges() []ent.Edge

func (Plan) Fields

func (Plan) Fields() []ent.Field

func (Plan) Indexes

func (Plan) Indexes() []ent.Index

func (Plan) Mixin

func (Plan) Mixin() []ent.Mixin

type PlanAddon

type PlanAddon struct {
	ent.Schema
}

func (PlanAddon) Edges

func (PlanAddon) Edges() []ent.Edge

func (PlanAddon) Fields

func (PlanAddon) Fields() []ent.Field

func (PlanAddon) Indexes

func (PlanAddon) Indexes() []ent.Index

func (PlanAddon) Mixin

func (PlanAddon) Mixin() []ent.Mixin

type PlanPhase

type PlanPhase struct {
	ent.Schema
}

func (PlanPhase) Edges

func (PlanPhase) Edges() []ent.Edge

func (PlanPhase) Fields

func (PlanPhase) Fields() []ent.Field

func (PlanPhase) Indexes

func (PlanPhase) Indexes() []ent.Index

func (PlanPhase) Mixin

func (PlanPhase) Mixin() []ent.Mixin

type PlanRateCard

type PlanRateCard struct {
	ent.Schema
}

func (PlanRateCard) Edges

func (PlanRateCard) Edges() []ent.Edge

func (PlanRateCard) Fields

func (PlanRateCard) Fields() []ent.Field

func (PlanRateCard) Indexes

func (PlanRateCard) Indexes() []ent.Index

func (PlanRateCard) Mixin

func (PlanRateCard) Mixin() []ent.Mixin

type RateCard

type RateCard struct {
	mixin.Schema
}

func (RateCard) Fields

func (RateCard) Fields() []ent.Field

type Subscription

type Subscription struct {
	ent.Schema
}

func (Subscription) Edges

func (Subscription) Edges() []ent.Edge

func (Subscription) Fields

func (Subscription) Fields() []ent.Field

func (Subscription) Indexes

func (Subscription) Indexes() []ent.Index

func (Subscription) Mixin

func (Subscription) Mixin() []ent.Mixin

type SubscriptionAddon

type SubscriptionAddon struct {
	ent.Schema
}

SubscriptionAddon is an instantiated addon for a subscription

func (SubscriptionAddon) Edges

func (SubscriptionAddon) Edges() []ent.Edge

func (SubscriptionAddon) Fields

func (SubscriptionAddon) Fields() []ent.Field

func (SubscriptionAddon) Mixin

func (SubscriptionAddon) Mixin() []ent.Mixin

type SubscriptionAddonQuantity

type SubscriptionAddonQuantity struct {
	ent.Schema
}

func (SubscriptionAddonQuantity) Edges

func (SubscriptionAddonQuantity) Fields

func (SubscriptionAddonQuantity) Fields() []ent.Field

func (SubscriptionAddonQuantity) Indexes

func (SubscriptionAddonQuantity) Indexes() []ent.Index

func (SubscriptionAddonQuantity) Mixin

type SubscriptionItem

type SubscriptionItem struct {
	ent.Schema
}

func (SubscriptionItem) Edges

func (SubscriptionItem) Edges() []ent.Edge

func (SubscriptionItem) Fields

func (SubscriptionItem) Fields() []ent.Field

func (SubscriptionItem) Indexes

func (SubscriptionItem) Indexes() []ent.Index

func (SubscriptionItem) Mixin

func (SubscriptionItem) Mixin() []ent.Mixin

type SubscriptionPhase

type SubscriptionPhase struct {
	ent.Schema
}

func (SubscriptionPhase) Edges

func (SubscriptionPhase) Edges() []ent.Edge

func (SubscriptionPhase) Fields

func (SubscriptionPhase) Fields() []ent.Field

func (SubscriptionPhase) Indexes

func (SubscriptionPhase) Indexes() []ent.Index

func (SubscriptionPhase) Mixin

func (SubscriptionPhase) Mixin() []ent.Mixin

type TotalsMixin

type TotalsMixin struct {
	mixin.Schema
}

func (TotalsMixin) Fields

func (m TotalsMixin) Fields() []ent.Field

type UsageReset

type UsageReset struct {
	ent.Schema
}

func (UsageReset) Edges

func (UsageReset) Edges() []ent.Edge

func (UsageReset) Fields

func (UsageReset) Fields() []ent.Field

func (UsageReset) Indexes

func (UsageReset) Indexes() []ent.Index

func (UsageReset) Mixin

func (UsageReset) Mixin() []ent.Mixin

Jump to

Keyboard shortcuts

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