Skip to main content

license.go

license.go - Overview

This file defines the data structures for licenses, sites, feature statuses, and license version 3 used within the application. It leverages the bun ORM for database interaction.

Detailed Documentation

Type: License

  • Purpose: Represents a license with details like key, creation and update timestamps, plan details, activation ID, validation message, and last validation timestamp.
  • Parameters: None
  • Returns: None

Fields:

  • bun.BaseModel: Embedded struct from the bun library providing base model functionality.
  • Key: License key (string, primary key, text type).
  • CreatedAt: Creation timestamp (time.Time, default: current_timestamp).
  • UpdatedAt: Last update timestamp (time.Time, default: current_timestamp).
  • PlanDetails: Details of the license plan (string, text type).
  • ActivationID: Activation ID associated with the license (string, text type).
  • ValidationMessage: Validation message for the license (string, text type).
  • LastValidated: Last validation timestamp (time.Time, default: current_timestamp).

Type: Site

  • Purpose: Represents a site with a UUID, alias, URL, and creation timestamp.
  • Parameters: None
  • Returns: None

Fields:

  • bun.BaseModel: Embedded struct from the bun library providing base model functionality.
  • UUID: Unique identifier for the site (string, primary key, text type).
  • Alias: Alias for the site (string, varchar(180), default: 'PROD').
  • URL: URL of the site (string, varchar(300)).
  • CreatedAt: Creation timestamp (time.Time, default: current_timestamp).

Type: FeatureStatus

  • Purpose: Represents the status of a feature, including its name, active state, usage, usage limit, and route.
  • Parameters: None
  • Returns: None

Fields:

  • bun.BaseModel: Embedded struct from the bun library providing base model functionality.
  • Name: Name of the feature (string, primary key, text type).
  • Active: Indicates whether the feature is active (bool).
  • Usage: Current usage of the feature (int, default: 0).
  • UsageLimit: Usage limit for the feature (int, default: 0).
  • Route: Route associated with the feature (string, text type).

Type: LicenseV3

  • Purpose: Represents a license version 3, including its ID, key, and data.
  • Parameters: None
  • Returns: None

Fields:

  • bun.BaseModel: Embedded struct from the bun library providing base model functionality.
  • ID: Unique identifier for the license (string, primary key, text type).
  • Key: License key (string, text type, not null, unique).
  • Data: License data (string, text type).

Code Examples

None

Clarity and Accuracy

The documentation is derived directly from the code.

Include in Getting Started: NO