コード例 #1
0
ファイル: 0_Task.go プロジェクト: quintans/taskboard
func (this *Task) Copy(entity *Task) {
	if entity != nil {
		this.EntityAudit.Copy(entity.EntityAudit)
		// attributes
		this.Title = app.CopyString(entity.Title)
		this.Detail = app.CopyString(entity.Detail)
		this.HeadColor = app.CopyString(entity.HeadColor)
		this.BodyColor = app.CopyString(entity.BodyColor)
		this.Position = app.CopyInteger(entity.Position)
		this.Reference = app.CopyString(entity.Reference)
		this.Spent = app.CopyInteger(entity.Spent)
		this.Remaining = app.CopyInteger(entity.Remaining)
		// associations
		this.User = entity.User
		this.Lane = entity.Lane
		this.Notifications = make([]*Notification, len(entity.Notifications), cap(entity.Notifications))
		copy(this.Notifications, entity.Notifications)
	}
}
コード例 #2
0
ファイル: 0_Lane.go プロジェクト: quintans/taskboard
func (this *Lane) Copy(entity *Lane) {
	if entity != nil {
		this.EntityAudit.Copy(entity.EntityAudit)
		// attributes
		this.Name = app.CopyString(entity.Name)
		this.Position = app.CopyInteger(entity.Position)
		// associations
		this.Board = entity.Board
		this.Tasks = make([]*Task, len(entity.Tasks), cap(entity.Tasks))
		copy(this.Tasks, entity.Tasks)
		this.Notifications = make([]*Notification, len(entity.Notifications), cap(entity.Notifications))
		copy(this.Notifications, entity.Notifications)
	}
}