models

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is a ...
	ErrKeyNotFound = errors.New("key not found")

	// ErrLicenseNotFound is a ...
	ErrLicenseNotFound = errors.New("license not found")

	// ErrTariffNotFound is a ...
	ErrTariffNotFound = errors.New("tariff not found")

	// ErrCustomerNotFound is a ...
	ErrCustomerNotFound = errors.New("customer not found")
)

Functions

func CustomersList

func CustomersList() *[]Customer

CustomersList is a ...

func DeactivateLicenseBySubID

func DeactivateLicenseBySubID(uid uint32) error

DeactivateLicenseBySubID is a ...

func LicensesListBySubscriptionID

func LicensesListBySubscriptionID(uid string) *[]License

LicensesListBySubscriptionID is a ...

func SubscriptionsByCustomerID

func SubscriptionsByCustomerID(customerID string) *[]CustomerSubscriptionsList

SubscriptionsByCustomerID is a ...

func TariffsList

func TariffsList() *[]Tariff

tariffsList is a ...

Types

type Customer

type Customer struct {
	ID        uint32    `gorm:"primary_key;auto_increment" json:"id"`
	Name      string    `gorm:"size:255;not null;unique" json:"name"`
	Status    bool      `gorm:"false" json:"status"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

Customer is a ...

func (*Customer) DeleteCustomer

func (c *Customer) DeleteCustomer(uid uint32) (int64, error)

DeleteCustomer is a ...

func (*Customer) FindCustomerByID

func (c *Customer) FindCustomerByID(uid uint32) (*Customer, error)

FindCustomerByID is a ...

func (*Customer) SaveCustomer

func (c *Customer) SaveCustomer() (*Customer, error)

SaveCustomer is a ...

func (*Customer) UpdateCustomer

func (c *Customer) UpdateCustomer(uid uint32) (*Customer, error)

UpdateCustomer is a ...

type CustomerSubscriptionsList

type CustomerSubscriptionsList struct {
	ID           uint32    `json:"id"`
	StripeID     string    `json:"stripe_id"`
	CustomerID   string    `json:"customer_id"`
	CustomerName string    `json:"customer_name"`
	TariffID     uint32    `json:"tariff_id"`
	TariffName   string    `json:"tariff_name"`
	Status       bool      `json:"status"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

CustomerSubscriptionsList is a ...

type License

type License struct {
	ID             uint32    `gorm:"primary_key;auto_increment" json:"id"`
	SubscriptionID uint32    `sql:"type:int REFERENCES subscriptions(id)" json:"subscription_id"`
	License        []byte    `gorm:"null" json:"license"`
	Hash           string    `gorm:"null" json:"hash"`
	Status         bool      `gorm:"false" json:"status"`
	CreatedAt      time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt      time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

License is a ...

func (*License) DeleteLicense

func (l *License) DeleteLicense(uid uint32) (int64, error)

DeleteLicense is a ...

func (*License) FindLicense

func (l *License) FindLicense(key []byte) (*License, error)

FindLicense is a ...

func (*License) FindLicenseByID

func (l *License) FindLicenseByID(uid uint32) (*License, error)

FindLicenseByID is a ...

func (*License) SaveLicense

func (l *License) SaveLicense() (*License, error)

SaveLicense is a ...

func (*License) UpdateLicense

func (l *License) UpdateLicense(uid uint32) (*License, error)

UpdateLicense is a ...

type Subscription

type Subscription struct {
	ID         uint32    `gorm:"primary_key;auto_increment" json:"id"`
	StripeID   string    `gorm:"size:18;not null;unique" json:"stripe_id"`
	CustomerID uint32    `sql:"type:int REFERENCES customers(id)" json:"customer_id"`
	TariffID   uint32    `sql:"type:int REFERENCES tariffs(id)" json:"tariff_id"`
	Status     bool      `gorm:"false" json:"status"`
	CreatedAt  time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt  time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

Subscription is a ...

func (*Subscription) DeleteSubscription

func (s *Subscription) DeleteSubscription(uid uint32) (int64, error)

DeleteSubscription is a ...

func (*Subscription) FindSubscriptionByID

func (s *Subscription) FindSubscriptionByID(uid uint32) (*Subscription, error)

FindSubscriptionByID is a ...

func (*Subscription) FindSubscriptionByStripeID

func (s *Subscription) FindSubscriptionByStripeID(stripeID string) (*Subscription, error)

FindSubscriptionByStripeID is a ...

func (*Subscription) SaveSubscription

func (s *Subscription) SaveSubscription() (*Subscription, error)

SaveSubscription is a ...

func (*Subscription) UpdateSubscription

func (s *Subscription) UpdateSubscription(uid uint32) (*Subscription, error)

UpdateSubscription is a ...

type Tariff

type Tariff struct {
	ID        uint32    `gorm:"primary_key;auto_increment" json:"id"`
	Name      string    `gorm:"size:255;not null;unique" json:"name"`
	Price     int       `gorm:"size:6;not null" json:"price"`
	Tandem    bool      `gorm:"size:1;not null" json:"crossbar"`
	Triaxis   bool      `gorm:"size:1;not null" json:"triaxis"`
	Robots    bool      `gorm:"size:1;not null" json:"robots"`
	Users     int       `gorm:"size:6;not null" json:"users"`
	CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
	UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
}

Tariff is a ...

func (*Tariff) DeleteTariff

func (t *Tariff) DeleteTariff(uid uint32) (int64, error)

DeleteTariff is a ...

func (*Tariff) FindTariffByID

func (t *Tariff) FindTariffByID(uid uint32) (*Tariff, error)

FindTariffByID is a ...

func (*Tariff) SaveTariff

func (t *Tariff) SaveTariff() (*Tariff, error)

SaveTariff is a ...

func (*Tariff) UpdateTariff

func (t *Tariff) UpdateTariff(uid uint32) (*Tariff, error)

UpdateTariff is a ...

Jump to

Keyboard shortcuts

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