30 lines
		
	
	
		
			682 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			682 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package tasks_utils
 | |
| 
 | |
| import (
 | |
| 	"time"
 | |
| 
 | |
| 	"git.andr3h3nriqu3s.com/andr3/fyp/logic/db"
 | |
| 	dbtypes "git.andr3h3nriqu3s.com/andr3/fyp/logic/db_types"
 | |
| )
 | |
| 
 | |
| type RunnerType int64
 | |
| 
 | |
| const (
 | |
| 	RUNNER_TYPE_GPU RunnerType = iota + 1
 | |
| )
 | |
| 
 | |
| type Runner struct {
 | |
| 	Id       string     `json:"id" db:"ru.id"`
 | |
| 	UserId   string     `json:"user_id" db:"ru.user_id"`
 | |
| 	Token    string     `json:"token" db:"ru.token"`
 | |
| 	Type     RunnerType `json:"type" db:"ru.type"`
 | |
| 	CreateOn time.Time  `json:"createOn" db:"ru.created_on"`
 | |
| }
 | |
| 
 | |
| func GetRunner(db db.Db, id string) (ru *Runner, err error) {
 | |
| 	var runner Runner
 | |
| 	err = dbtypes.GetDBOnce(db, &runner, "remote_runner as ru where ru.id=$1", id)
 | |
| 	ru = &runner
 | |
| 	return
 | |
| }
 |