model

package
v0.0.0-...-4b1f759 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FREE plan, 100 users
	FREE = Plan("FREE")
	// ENTERPRISE plan, 1000 users
	ENTERPRISE = Plan("ENTERPRISE")
)

Variables

View Source
var APIkeyTableSQL = `CREATE TABLE IF NOT EXISTS apikey (
	key_hash CHARACTER(64) PRIMARY KEY,
	account_id CHARACTER(36));`

APIkeyTableSQL is the SQL statement for creating a table corresponding to the APIkey model

View Source
var AccountTableSQL = `` /* 242-byte string literal not displayed */

AccountTableSQL is the SQL statement for creating a table corresponding to the Account model

View Source
var MetricTableSQL = `` /* 147-byte string literal not displayed */

MetricTableSQL is the SQL statement for createing a table corresponding to the Metric model

View Source
var PlanMaxUsers = map[Plan]int{
	FREE:       100,
	ENTERPRISE: 1000,
}

PlanMaxUsers specifies the maximum number of users for each plan

View Source
var UserTableSQL = `` /* 162-byte string literal not displayed */

UserTableSQL is the SQL statement for createing a table corresponding to the User model

Functions

This section is empty.

Types

type APIkey

type APIkey struct {
	KeyHash   string `db:"key_hash"`
	AccountID string `db:"account_id"`
}

APIkey represents a row in the "apikey" table

type Account

type Account struct {
	AccountID    string    `db:"account_id"`
	Plan         Plan      `db:"plan"` // One of "FREE" or "ENTERPRISE"
	Email        string    `db:"email"`
	PasswordHash string    `db:"password_hash"`
	CreatedAt    time.Time `db:"created_at"`
	UpdatedAt    time.Time `db:"updated_at"`
}

Account represents a row in the "account" table.

type Metric

type Metric struct {
	MetricID  string    `db:"metric_id"`
	AccountID string    `db:"account_id"`
	UserID    string    `db:"user_id"`
	Timestamp time.Time `db:"timestamp"`
}

Metric represents a row in the "metric" table

type Plan

type Plan string

Plan is the type of plan (FREE or ENTERPRISE) for a given account

type User

type User struct {
	UserID    string    `db:"user_id"`
	AccountID string    `db:"account_id"`
	IsActive  bool      `db:"is_active"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

User represents a row in the "user" table

Jump to

Keyboard shortcuts

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