mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
28 lines
569 B
Go
28 lines
569 B
Go
package workflow
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/uptrace/bun"
|
|
)
|
|
|
|
type Workflow struct {
|
|
bun.BaseModel `bun:"table:workflows"`
|
|
ID string `json:"id" bun:",pk"`
|
|
Config Config `json:"config"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
DeletedAt *time.Time `json:"deletedAt"`
|
|
}
|
|
|
|
func New(config Config) Workflow {
|
|
now := time.Now().Round(time.Nanosecond)
|
|
return Workflow{
|
|
ID: uuid.NewString(),
|
|
Config: config,
|
|
CreatedAt: now,
|
|
UpdatedAt: now,
|
|
}
|
|
}
|