mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-07 06:30:53 +08:00
32 lines
559 B
Go
32 lines
559 B
Go
package model
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"time"
|
|
)
|
|
|
|
type WorkflowTemplate struct {
|
|
ID uint64
|
|
CreatedAt time.Time `db:"created_at"`
|
|
UID string
|
|
Name string
|
|
Manifest string
|
|
Version int32
|
|
IsLatest bool `db:"is_latest"`
|
|
IsArchived bool `db:"is_archived"`
|
|
}
|
|
|
|
func (wt *WorkflowTemplate) GetManifestBytes() []byte {
|
|
return []byte(wt.Manifest)
|
|
}
|
|
|
|
func (wt *WorkflowTemplate) GenerateUID() (string, error) {
|
|
uid, err := uuid.NewRandom()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
wt.UID = uid.String()
|
|
|
|
return wt.UID, nil
|
|
}
|