feat: add OpenAI image generation controls

This commit is contained in:
2ue
2026-05-05 03:26:54 +08:00
parent 4de28fec8c
commit 6faa344916
85 changed files with 6086 additions and 568 deletions
+30
View File
@@ -44,6 +44,12 @@ const (
FieldMonthlyLimitUsd = "monthly_limit_usd"
// FieldDefaultValidityDays holds the string denoting the default_validity_days field in the database.
FieldDefaultValidityDays = "default_validity_days"
// FieldAllowImageGeneration holds the string denoting the allow_image_generation field in the database.
FieldAllowImageGeneration = "allow_image_generation"
// FieldImageRateIndependent holds the string denoting the image_rate_independent field in the database.
FieldImageRateIndependent = "image_rate_independent"
// FieldImageRateMultiplier holds the string denoting the image_rate_multiplier field in the database.
FieldImageRateMultiplier = "image_rate_multiplier"
// FieldImagePrice1k holds the string denoting the image_price_1k field in the database.
FieldImagePrice1k = "image_price_1k"
// FieldImagePrice2k holds the string denoting the image_price_2k field in the database.
@@ -167,6 +173,9 @@ var Columns = []string{
FieldWeeklyLimitUsd,
FieldMonthlyLimitUsd,
FieldDefaultValidityDays,
FieldAllowImageGeneration,
FieldImageRateIndependent,
FieldImageRateMultiplier,
FieldImagePrice1k,
FieldImagePrice2k,
FieldImagePrice4k,
@@ -239,6 +248,12 @@ var (
SubscriptionTypeValidator func(string) error
// DefaultDefaultValidityDays holds the default value on creation for the "default_validity_days" field.
DefaultDefaultValidityDays int
// DefaultAllowImageGeneration holds the default value on creation for the "allow_image_generation" field.
DefaultAllowImageGeneration bool
// DefaultImageRateIndependent holds the default value on creation for the "image_rate_independent" field.
DefaultImageRateIndependent bool
// DefaultImageRateMultiplier holds the default value on creation for the "image_rate_multiplier" field.
DefaultImageRateMultiplier float64
// DefaultClaudeCodeOnly holds the default value on creation for the "claude_code_only" field.
DefaultClaudeCodeOnly bool
// DefaultModelRoutingEnabled holds the default value on creation for the "model_routing_enabled" field.
@@ -343,6 +358,21 @@ func ByDefaultValidityDays(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDefaultValidityDays, opts...).ToFunc()
}
// ByAllowImageGeneration orders the results by the allow_image_generation field.
func ByAllowImageGeneration(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAllowImageGeneration, opts...).ToFunc()
}
// ByImageRateIndependent orders the results by the image_rate_independent field.
func ByImageRateIndependent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImageRateIndependent, opts...).ToFunc()
}
// ByImageRateMultiplier orders the results by the image_rate_multiplier field.
func ByImageRateMultiplier(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImageRateMultiplier, opts...).ToFunc()
}
// ByImagePrice1k orders the results by the image_price_1k field.
func ByImagePrice1k(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImagePrice1k, opts...).ToFunc()
+75
View File
@@ -125,6 +125,21 @@ func DefaultValidityDays(v int) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldDefaultValidityDays, v))
}
// AllowImageGeneration applies equality check predicate on the "allow_image_generation" field. It's identical to AllowImageGenerationEQ.
func AllowImageGeneration(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldAllowImageGeneration, v))
}
// ImageRateIndependent applies equality check predicate on the "image_rate_independent" field. It's identical to ImageRateIndependentEQ.
func ImageRateIndependent(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImageRateIndependent, v))
}
// ImageRateMultiplier applies equality check predicate on the "image_rate_multiplier" field. It's identical to ImageRateMultiplierEQ.
func ImageRateMultiplier(v float64) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImageRateMultiplier, v))
}
// ImagePrice1k applies equality check predicate on the "image_price_1k" field. It's identical to ImagePrice1kEQ.
func ImagePrice1k(v float64) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImagePrice1k, v))
@@ -900,6 +915,66 @@ func DefaultValidityDaysLTE(v int) predicate.Group {
return predicate.Group(sql.FieldLTE(FieldDefaultValidityDays, v))
}
// AllowImageGenerationEQ applies the EQ predicate on the "allow_image_generation" field.
func AllowImageGenerationEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldAllowImageGeneration, v))
}
// AllowImageGenerationNEQ applies the NEQ predicate on the "allow_image_generation" field.
func AllowImageGenerationNEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldNEQ(FieldAllowImageGeneration, v))
}
// ImageRateIndependentEQ applies the EQ predicate on the "image_rate_independent" field.
func ImageRateIndependentEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImageRateIndependent, v))
}
// ImageRateIndependentNEQ applies the NEQ predicate on the "image_rate_independent" field.
func ImageRateIndependentNEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldNEQ(FieldImageRateIndependent, v))
}
// ImageRateMultiplierEQ applies the EQ predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierEQ(v float64) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImageRateMultiplier, v))
}
// ImageRateMultiplierNEQ applies the NEQ predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierNEQ(v float64) predicate.Group {
return predicate.Group(sql.FieldNEQ(FieldImageRateMultiplier, v))
}
// ImageRateMultiplierIn applies the In predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierIn(vs ...float64) predicate.Group {
return predicate.Group(sql.FieldIn(FieldImageRateMultiplier, vs...))
}
// ImageRateMultiplierNotIn applies the NotIn predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierNotIn(vs ...float64) predicate.Group {
return predicate.Group(sql.FieldNotIn(FieldImageRateMultiplier, vs...))
}
// ImageRateMultiplierGT applies the GT predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierGT(v float64) predicate.Group {
return predicate.Group(sql.FieldGT(FieldImageRateMultiplier, v))
}
// ImageRateMultiplierGTE applies the GTE predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierGTE(v float64) predicate.Group {
return predicate.Group(sql.FieldGTE(FieldImageRateMultiplier, v))
}
// ImageRateMultiplierLT applies the LT predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierLT(v float64) predicate.Group {
return predicate.Group(sql.FieldLT(FieldImageRateMultiplier, v))
}
// ImageRateMultiplierLTE applies the LTE predicate on the "image_rate_multiplier" field.
func ImageRateMultiplierLTE(v float64) predicate.Group {
return predicate.Group(sql.FieldLTE(FieldImageRateMultiplier, v))
}
// ImagePrice1kEQ applies the EQ predicate on the "image_price_1k" field.
func ImagePrice1kEQ(v float64) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImagePrice1k, v))