Documentation
¶
Index ¶
- Variables
- func SendPasswordReset(secret string, user *User) error
- type AccessToken
- type AccessTokenDao
- type Build
- type Charge
- type Comment
- type Dependency
- type Endpoint
- type Issue
- type Post
- type Project
- type Reset
- type ResetDao
- type Star
- type Token
- type User
- type UserDao
- func (ud *UserDao) Create(u User) error
- func (ud *UserDao) GetByEmail(email string) (User, error)
- func (ud *UserDao) GetById(id string) (User, error)
- func (ud *UserDao) GetByIds(ids []string) ([]User, error)
- func (ud *UserDao) GetByNick(nick string) (User, error)
- func (ud *UserDao) OLDUpdate(u User) error
- func (ud *UserDao) Update(u User) error
Constants ¶
This section is empty.
Variables ¶
var Sid *shortid.Shortid
Functions ¶
func SendPasswordReset ¶
Types ¶
type AccessToken ¶
type AccessToken struct {
Id string
Token string
UserId string
CreatedAt time.Time
UpdatedAt time.Time
}
An AccessToken is used for logins. It is used to call 1Backend daemon endpoints (not services running on 1Backend).
type AccessTokenDao ¶
type AccessTokenDao struct {
// contains filtered or unexported fields
}
func NewAccessTokenDao ¶
func NewAccessTokenDao(db *gorm.DB) *AccessTokenDao
func (*AccessTokenDao) Create ¶
func (at *AccessTokenDao) Create(model AccessToken) error
func (*AccessTokenDao) Delete ¶
func (at *AccessTokenDao) Delete(id string) error
func (*AccessTokenDao) DeleteByToken ¶
func (at *AccessTokenDao) DeleteByToken(token string) error
func (*AccessTokenDao) GetByToken ¶
func (at *AccessTokenDao) GetByToken(token string) (AccessToken, error)
type Build ¶
type Build struct {
Id string
Output string
Success bool
ProjectId string
// Version of the project at the time of the build
Version string
InProgress bool
CreatedAt time.Time
UpdatedAt time.Time
}
A Build is pretty much what the name says: a verification of the project when it's saved.
type Charge ¶
type Charge struct {
Id string
Amount int
UserId string
Description string
CreatedAt time.Time
UpdatedAt time.Time
}
A Charge is just a bookkeeping entitity - 1Backend saves one when a user pays for platform usage (if the given 1Backend installation is configured as a cloud provider)
type Comment ¶
type Comment struct {
Id string
IssueId string
Content string
UserId string
User User
Issue Issue
CreatedAt time.Time
UpdatedAt time.Time
}
A Comment represents one comment out of the many that can belong to an `Issue`
type Dependency ¶
type Dependency struct {
Id string
ProjectId string
Config string
Type string
CreatedAt time.Time
UpdatedAt time.Time
}
A Dependency is an infrastructural element (eg. SQL server)
type Endpoint ¶
type Endpoint struct {
Id string
Url string
Description string
Method string
Code string
// JSON that defines the input structure
Input string
// JSON that defines the output structure
Output string
ProjectId string
CreatedAt time.Time
UpdatedAt time.Time
}
An Endpoint is a lambda as a HTTP endpoint
type Issue ¶
type Issue struct {
Id string
ProjectId string
Title string
UserId string
User User
Comments []Comment
CommentCount int
CreatedAt time.Time
UpdatedAt time.Time
}
An Issue is just like a GitHub repo issue, except it's for 1Backend services.
type Post ¶
type Post struct {
Id string
Title string
Slug string
Content string
UserId string
User User
CreatedAt time.Time
UpdatedAt time.Time
}
A Post is a blog post that users can publish under their profile.
type Project ¶
type Project struct {
Id string
// Password for infrastructural elements like mysql, redis etc
InfraPassword string `json:"-"`
// A secret value used to map projects to namespaces
CallerId string `json:"-"`
// Author name.
Author string
// Project name - make it nice, because it appears everywhere
Name string
// Project namespace. Defaults to `$AUTHOR:default`
Namespace string
Stars int
// Semver version of the project.
Version string
// A readme that appears on the front page
ReadMe string
// The port of the running instance for internal use.
// Might have to extend this contept to support multiple instances.
Port int
// Private repos can only be read by their owner (no organisations yet)
Public bool
// Source code is visible to those who can view the project
OpenSource bool
// Short description of the project)
Description string
// Eg. go, nodejs, docker
Mode string
// Different setups inside the same tech (see language)
Recipe string
// Secrets as envars for open source applications with private keys
Secrets string
// eg. requires for nodejs or github imports for go apps
Imports string
// eg. package.json for nodejs apps
Packages string
// JSON that defines the types belonging to this project
Types string
// Source contains source code if the project mode/recipe does not use the code from the endpoints
Source string
// Github ssh for private code
Endpoints []Endpoint
Builds []Build
Dependencies []Dependency
Issues []Issue
CreatedAt time.Time
UpdatedAt time.Time
// Very stupid, I know
Starrers []User `gorm:"many2many:stars;"`
}
A Project is a Go, Node, TypeScript etc. application
type ResetDao ¶
type ResetDao struct {
// contains filtered or unexported fields
}
func NewResetDao ¶
type Token ¶
type Token struct {
Id string
Token string
UserId string
Name string // eg. "test", "xyz-app" etc. max 32 chars
Description string
Quota int64 `gorm:"-"`
CreatedAt time.Time
UpdatedAt time.Time
}
A Token or a service access token is like a service key used to call services running on 1Backend (not the 1Backend daemon itself).
type User ¶
type User struct {
Id string
Password string `json:"-"`
Nick string
Name string
Email string
AvatarLink string
Tokens []Token
Posts []Post
Premium bool
CreatedAt time.Time
UpdatedAt time.Time
}
A User is a registered user of a 1Backend installation