Documentation ¶
Index ¶
- Constants
- Variables
- type License
- type LicenseManager
- func (licManager LicenseManager) Add(licenses License) error
- func (licManager LicenseManager) AddFromJSON(licensesJSON []byte) error
- func (licManager LicenseManager) Delete(id int64) error
- func (licManager LicenseManager) Get(id int64) (License, error)
- func (licManager LicenseManager) GetFiltered(filter string) ([]License, error)
- func (licManager LicenseManager) PurgeDataBase() error
- func (licManager LicenseManager) Update(lic License) error
- type Licenses
- type WebLicense
Constants ¶
View Source
const ( StatusDraft string = "draft" StatusEncrypting string = "encrypting" StatusError string = "error" StatusOk string = "ok" )
License status
Variables ¶
View Source
var ErrNotFound = errors.New("License not found")
ErrNotFound error trown when license is not found
Functions ¶
This section is empty.
Types ¶
type License ¶
type License struct { ID string `json:""` PublicationTitle string `json:"publication_title"` UserName string `json:"user_name"` Type string `json:"type"` UUID string `json:"id"` DeviceCount int `json:"device_count"` Status string `json:"status"` PurchaseID int `json:"purchase_id"` Message string `json:"message"` }
License struct defines a license
type LicenseManager ¶
type LicenseManager struct {
// contains filtered or unexported fields
}
LicenseManager helper
func (LicenseManager) Add ¶
func (licManager LicenseManager) Add(licenses License) error
Add adds a new license
func (LicenseManager) AddFromJSON ¶
func (licManager LicenseManager) AddFromJSON(licensesJSON []byte) error
AddFromJSON adds a new license from a JSON string
func (LicenseManager) Delete ¶
func (licManager LicenseManager) Delete(id int64) error
Delete deletes a license
func (LicenseManager) Get ¶
func (licManager LicenseManager) Get(id int64) (License, error)
Get a license for a given ID
func (LicenseManager) GetFiltered ¶
func (licManager LicenseManager) GetFiltered(filter string) ([]License, error)
GetFiltered give a license with more than the filtered number
func (LicenseManager) PurgeDataBase ¶
func (licManager LicenseManager) PurgeDataBase() error
PurgeDataBase erases all the content of the license_view table
func (LicenseManager) Update ¶
func (licManager LicenseManager) Update(lic License) error
Update updates a license
type Licenses ¶
type Licenses []struct { ID string `json:""` UUID string `json:"id"` Status string `json:"status"` DeviceCount int `json:"device_count"` Message string `json:"message"` }
Licenses struct defines a licenses array to be transfered
type WebLicense ¶
type WebLicense interface { Get(id int64) (License, error) GetFiltered(filter string) ([]License, error) Add(license License) error AddFromJSON(licensesJSON []byte) error PurgeDataBase() error Update(license License) error Delete(id int64) error }
WebLicense interface for license db interaction
func Init ¶
func Init(config config.Configuration, db *sql.DB) (i WebLicense, err error)
Init inits the license manager
Click to show internal directories.
Click to hide internal directories.