2
1
Fork 0
swim/story.go

37 lines
739 B
Go

package main
import (
"time"
)
type Story struct {
Title string
Body string
Users []string
Tag int
Tasks []Task
Comments []Comment
Created time.Time
Updated time.Time
}
func (s Story) Duplicate() Story {
out := Story{}
out.Title = s.Title
out.Body = s.Body
out.Users = make([]string, len(s.Users))
copy(out.Users, s.Users)
out.Tag = s.Tag
out.Tasks = make([]Task, len(s.Tasks))
copy(out.Tasks, s.Tasks)
out.Comments = make([]Comment, len(s.Comments))
copy(out.Comments, s.Comments)
out.Created = s.Created
out.Updated = s.Updated
return out
}
func MakeStory(title string) Story {
return Story{title,"", make([]string,0,2), -1, make([]Task,0,2), make([]Comment,0,2), time.Now(), time.Now()}
}