db

package
v0.0.0-...-6ecb9a7 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func Connect

func Connect() error

Types

type App

type App struct {
	Model
	Name string
	// The app's Dokku name
	ShortName string
	TeamID    uint
}

type Build

type Build struct {
	ID        uint      `gorm:"primary_key"`
	ExecID    uuid.UUID `gorm:"index,unique"`
	AppID     uint      `gorm:"index"`
	StartedAt time.Time
	EndedAt   time.Time
	Running   bool
	Events    pq.StringArray `gorm:"type:text[]"`
	Status    int
}

type Model

type Model struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

Model is a clone of a gorm.Model, but without the `DeletedAt` field

type Team

type Team struct {
	Model
	Name      string
	Avatar    string
	Automatic bool            // Whether the team was created automatically for ad-hoc app sharing
	Personal  bool            // Whether this is a user's personal team
	Expenses  decimal.Decimal `gorm:"type:decimal(64, 18);default:0"` // Outstanding expenses for this team
	Users     []*User         `gorm:"many2many:team_users;"`
	Apps      []App
}

type Token

type Token struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	Token     string `gorm:"primarykey"`
	ExpiresAt time.Time
	UserID    uint
}

type User

type User struct {
	Model
	SlackUserID string `gorm:"unique"`
	Name        string
	Avatar      string
	Teams       []*Team `gorm:"many2many:team_users;"`
	Tokens      []Token `json:"-"`
}

Jump to

Keyboard shortcuts

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