database

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateSchema = `` /* 2746-byte string literal not displayed */
View Source
var DropSchema = `` /* 292-byte string literal not displayed */

Functions

This section is empty.

Types

type DBError

type DBError struct {
	Query string `json:"query"`
	Err   error  `json:"error"`
}

func (*DBError) Error

func (e *DBError) Error() string

The error interface implementation, which formats to a JSON object string.

func (*DBError) Log

func (e *DBError) Log(tx string)

func (*DBError) Unwrap

func (e *DBError) Unwrap() error

type DBResult

type DBResult struct {
	// contains filtered or unexported fields
}

func (DBResult) LastInsertId

func (dbr DBResult) LastInsertId() (int64, error)

func (DBResult) RowsAffected

func (dbr DBResult) RowsAffected() (int64, error)

type DBService

type DBService struct {
	*sqlx.DB
}

func NewDBService

func NewDBService(db *sqlx.DB) DBService

func (DBService) Delete

func (u DBService) Delete(sql string, id int64) *DBError

func (DBService) MustExec

func (u DBService) MustExec(sql string, args ...interface{}) *DBError

func (DBService) NamedExec

func (u DBService) NamedExec(sql string, obj interface{}) (sql.Result, *DBError)

func (DBService) PrepareNamed

func (u DBService) PrepareNamed(sql string, arg interface{}) (sql.Result, *DBError)

type IDE

type IDE struct {
	ID   int64  `db:"id"`
	Name string `db:"name"`
}

type IDERepo

type IDERepo struct {
	ID        int64  `db:"id"`
	UserIDEID int64  `db:"user_ide_id"`
	URI       string `db:"uri"`
}

type IDERuntimeInstall

type IDERuntimeInstall struct {
	ID               int64 `db:"id"`
	UserIDEID        int64 `db:"user_ide_id"`
	RuntimeInstallID int64 `db:"runtime_install_id"`
}

type RuntimeInstall

type RuntimeInstall struct {
	ID         int64  `db:"id"`
	Name       string `db:"name"`
	ScriptBody string `db:"script_body"`
}

type User

type User struct {
	ID          int64  `db:"id"`
	GoogleID    string `db:"google_id"`
	Username    string `db:"username"`
	Password    string `db:"password"`
	Email       string `db:"email"`
	HashedEmail string `db:"hashed_email"`
	IsActive    bool   `db:"is_active"`
	PrivateKey  string `db:"private_key"`
	PublicKey   string `db:"public_key"`
	PublicKeyID int64  `db:"public_key_id"`
	DockerTag   string
}

func (User) String added in v0.1.7

func (s User) String() string

type UserIDE

type UserIDE struct {
	ID     int64 `db:"id"`
	UserID int64 `db:"user_id"`
	IDEID  int64 `db:"ide_id"`
}

type UserRepo

type UserRepo struct {
	ID     int64  `db:"id"`
	URI    string `db:"uri"`
	UserID int64  `db:"user_id"`
}

type UserService

type UserService struct {
	*DBService
}

func NewUserService

func NewUserService(db *sqlx.DB) UserService

func (UserService) Add

func (u UserService) Add(user User) (sql.Result, *DBError)

func (UserService) AddIDERepo

func (u UserService) AddIDERepo(ideRepo IDERepo) (sql.Result, *DBError)

func (UserService) AddIDERuntimeInstall

func (u UserService) AddIDERuntimeInstall(ideRuntimeInstall IDERuntimeInstall) (sql.Result, *DBError)

func (UserService) AddUserIDE

func (u UserService) AddUserIDE(userIDE UserIDE) (sql.Result, *DBError)

func (UserService) AddUserRepo

func (u UserService) AddUserRepo(userRepo UserRepo) (sql.Result, *DBError)

func (UserService) Delete

func (u UserService) Delete(id int64) *DBError

func (UserService) DeleteALLIDEReposForUser

func (u UserService) DeleteALLIDEReposForUser(userID int64) *DBError

func (UserService) DeleteALLIDERuntimeInstallsForUser

func (u UserService) DeleteALLIDERuntimeInstallsForUser(userID int64) *DBError

func (UserService) DeleteALLUserIDEsForUser

func (u UserService) DeleteALLUserIDEsForUser(userID int64) *DBError

func (UserService) DeleteALLUserReposForUser

func (u UserService) DeleteALLUserReposForUser(userID int64) *DBError

func (UserService) FindIDEByName

func (u UserService) FindIDEByName(name string) (IDE, *DBError)

func (UserService) FindIDEReposByUserID

func (u UserService) FindIDEReposByUserID(userID int64) ([]int64, *DBError)

func (UserService) FindRuntimeInstallByName

func (u UserService) FindRuntimeInstallByName(name string) (RuntimeInstall, *DBError)

func (UserService) FindUserByEmail

func (u UserService) FindUserByEmail(email string) (User, *DBError)

func (UserService) FindUserByGoogleID

func (u UserService) FindUserByGoogleID(googleIDHashed string) (User, *DBError)

func (UserService) FindUserByHashedEmail

func (u UserService) FindUserByHashedEmail(hashedEmail string) (User, *DBError)

func (UserService) FindUserByUsername

func (u UserService) FindUserByUsername(username string) (User, *DBError)

func (UserService) FindUserIDEReroURIsByUserAndIDE

func (u UserService) FindUserIDEReroURIsByUserAndIDE(username string, ide string) ([]string, *DBError)

func (UserService) FindUserIDERuntimeInstallsByUserAndIDE

func (u UserService) FindUserIDERuntimeInstallsByUserAndIDE(username string, ide string) ([]string, *DBError)

func (UserService) FindUserIDEsByUserID

func (u UserService) FindUserIDEsByUserID(userID int64) ([]int64, *DBError)

func (UserService) FindUserReposUserID

func (u UserService) FindUserReposUserID(userID int64) ([]int64, *DBError)

func (UserService) Get

func (u UserService) Get(id int64) (User, *DBError)

func (UserService) List

func (u UserService) List() ([]User, *DBError)

func (UserService) UpdateGoogleID

func (u UserService) UpdateGoogleID(user User) (sql.Result, *DBError)

func (UserService) UpdateProfile

func (u UserService) UpdateProfile(user User) (sql.Result, *DBError)

Jump to

Keyboard shortcuts

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