memory.go 529 B

123456789101112131415161718192021222324252627282930
  1. package pricing
  2. import (
  3. "context"
  4. "errors"
  5. )
  6. type MemoryPricingStore struct {
  7. pricing *PricingSet
  8. }
  9. func NewMemoryPricingStore() *MemoryPricingStore {
  10. return &MemoryPricingStore{
  11. pricing: &PricingSet{},
  12. }
  13. }
  14. func (mps *MemoryPricingStore) GetPricingSet(ctx context.Context) (*PricingSet, error) {
  15. return mps.pricing, nil
  16. }
  17. func (mps *MemoryPricingStore) SetPricingSet(ctx context.Context, pricing *PricingSet) error {
  18. if pricing == nil {
  19. return errors.New("nil pricing")
  20. }
  21. mps.pricing = pricing
  22. return nil
  23. }