本文整理匯總了Golang中github.com/HeinOldewage/Hyades.Work.Parameters方法的典型用法代碼示例。如果您正苦於以下問題:Golang Work.Parameters方法的具體用法?Golang Work.Parameters怎麽用?Golang Work.Parameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/HeinOldewage/Hyades.Work
的用法示例。
在下文中一共展示了Work.Parameters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetAll
func (jm *JobMap) GetAll(user *Hyades.Person) (jobs []*Hyades.Job, err error) {
conn, err := sql.Open("sqlite3", "file:"+jm.dbFile+"?_loc=auto&_busy_timeout=60000")
if err != nil {
return nil, err
}
defer conn.Close()
log.Println("Getting job for user", user.Username, user.Id)
res, err := conn.Query("Select * from JOBS where OwnerID = ?", user.Id)
if err != nil {
return nil, err
}
defer closeQuery(res)
for res.Next() {
job := &Hyades.Job{}
err := res.Scan(&job.Id, &job.OwnerID, &job.Name, &job.JobFolder, &job.Env, &job.ReturnEnv)
if err != nil {
log.Println(err)
}
log.Println("Job", job.Id, "Belongs to id", job.OwnerID)
partres, err := conn.Query("Select Id,DispatchTime,FinishTime,TotalTimeDispatched,Done,Dispatched,BeingHandled,FailCount,Error,Status,Command from JOBPARTS where OwnerID = ?", job.Id)
if err != nil {
log.Println(err)
}
defer closeQuery(partres)
for partres.Next() {
var part Hyades.Work
err := partres.Scan(&part.PartID, &part.DispatchTime, &part.FinishTime, &part.TotalTimeDispatched, &part.Done, &part.Dispatched, &part.BeingHandled, &part.FailCount, &part.Error, &part.Status, &part.Command)
if err != nil {
log.Println("partres.Scan", err)
}
paramres, err := conn.Query("Select Parameters from Parameters where JOBPARTSID = ?", part.PartID)
defer closeQuery(paramres)
for paramres.Next() {
var param string
err := paramres.Scan(¶m)
if err != nil {
log.Println("paramres.Scan", err)
}
part.Parameters = append(part.Parameters, param)
}
}
if partres.Err() != nil {
log.Println(partres.Err())
}
jobs = append(jobs, job)
}
return jobs, res.Err()
}
示例2: GetJob
func (jm *JobMap) GetJob(id string) (job *Hyades.Job, err error) {
conn, err := sql.Open("sqlite3", "file:"+jm.dbFile+"?_loc=auto&_busy_timeout=60000")
if err != nil {
return nil, err
}
defer conn.Close()
res, err := conn.Query("Select * from JOBS where ID = ?", id)
if err != nil {
return nil, err
}
defer closeQuery(res)
job = new(Hyades.Job)
if res.Next() {
res.Scan(&job.Id, &job.OwnerID, &job.Name, &job.JobFolder, &job.Env, &job.ReturnEnv)
}
log.Println("JobID", job.Id)
partres, err := conn.Query("Select Id,DispatchTime,FinishTime,TotalTimeDispatched,Done,Dispatched,BeingHandled,FailCount,Error,Status,Command from JOBPARTS where OwnerID = ?", job.Id)
if err != nil {
log.Println(err)
}
defer closeQuery(partres)
for partres.Next() {
var part *Hyades.Work = Hyades.NewWork(job)
err := partres.Scan(&part.PartID, &part.DispatchTime, &part.FinishTime, &part.TotalTimeDispatched, &part.Done, &part.Dispatched, &part.BeingHandled, &part.FailCount, &part.Error, &part.Status, &part.Command)
if err != nil {
log.Println("partres.Scan", err)
}
log.Println("PartId", part.PartID)
paramres, err := conn.Query("Select Parameters from Parameters where JOBPARTSID = ?", part.PartID)
defer closeQuery(paramres)
for paramres.Next() {
var param string
err := paramres.Scan(¶m)
if err != nil {
log.Println("paramres.Scan", err)
}
part.Parameters = append(part.Parameters, param)
}
}
if partres.Err() != nil {
log.Println(partres.Err())
}
log.Println("Job has", len(job.Parts), " parts")
return job, err
}