types

package
v1.0.0-rc.24 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromJsonString

func LoadFromJsonString[K comparable, V any](m *RWMap[K, V], jsonStr string) error

func LoadFromJsonStringWithCallback added in v0.10.9

func LoadFromJsonStringWithCallback[K comparable, V any](m *RWMap[K, V], jsonStr string, onSuccess func()) error

Types

type GroupRatioInfo

type GroupRatioInfo struct {
	GroupRatio        float64
	GroupSpecialRatio float64
	HasSpecialRatio   bool
}

type PriceData

type PriceData struct {
	FreeModel            bool
	ModelPrice           float64
	ModelRatio           float64
	CompletionRatio      float64
	CacheRatio           float64
	CacheCreationRatio   float64
	CacheCreation5mRatio float64
	CacheCreation1hRatio float64
	ImageRatio           float64
	AudioRatio           float64
	AudioCompletionRatio float64

	UsePrice          bool
	Quota             int // 按次计费的最终额度(MJ / Task)
	QuotaToPreConsume int // 按量计费的预消耗额度
	GroupRatioInfo    GroupRatioInfo
	// contains filtered or unexported fields
}

func (*PriceData) AddOtherRatio

func (p *PriceData) AddOtherRatio(key string, ratio float64)

func (*PriceData) ApplyOtherRatiosToDecimal

func (p *PriceData) ApplyOtherRatiosToDecimal(value decimal.Decimal) decimal.Decimal

func (*PriceData) ApplyOtherRatiosToFloat

func (p *PriceData) ApplyOtherRatiosToFloat(value float64) float64

func (*PriceData) HasOtherRatio

func (p *PriceData) HasOtherRatio(key string) bool

func (*PriceData) OtherRatioMultiplier

func (p *PriceData) OtherRatioMultiplier() float64

func (*PriceData) OtherRatios

func (p *PriceData) OtherRatios() map[string]float64

func (*PriceData) RemoveOtherRatiosFromFloat

func (p *PriceData) RemoveOtherRatiosFromFloat(value float64) float64

func (*PriceData) ReplaceOtherRatios

func (p *PriceData) ReplaceOtherRatios(ratios map[string]float64) bool

func (*PriceData) ToSetting

func (p *PriceData) ToSetting() string

type RWMap

type RWMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewRWMap

func NewRWMap[K comparable, V any]() *RWMap[K, V]

func (*RWMap[K, V]) AddAll

func (m *RWMap[K, V]) AddAll(other map[K]V)

func (*RWMap[K, V]) Clear

func (m *RWMap[K, V]) Clear()

func (*RWMap[K, V]) Get

func (m *RWMap[K, V]) Get(key K) (V, bool)

func (*RWMap[K, V]) Len

func (m *RWMap[K, V]) Len() int

func (*RWMap[K, V]) MarshalJSON

func (m *RWMap[K, V]) MarshalJSON() ([]byte, error)

func (*RWMap[K, V]) MarshalJSONString added in v0.10.9

func (m *RWMap[K, V]) MarshalJSONString() string

func (*RWMap[K, V]) ReadAll

func (m *RWMap[K, V]) ReadAll() map[K]V

func (*RWMap[K, V]) Set

func (m *RWMap[K, V]) Set(key K, value V)

func (*RWMap[K, V]) UnmarshalJSON

func (m *RWMap[K, V]) UnmarshalJSON(b []byte) error

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T comparable]() *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(item T)

func (*Set[T]) Contains

func (s *Set[T]) Contains(item T) bool

func (*Set[T]) Items

func (s *Set[T]) Items() []T

func (*Set[T]) Len

func (s *Set[T]) Len() int

func (*Set[T]) Remove

func (s *Set[T]) Remove(item T)

Jump to

Keyboard shortcuts

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