mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 19:53:21 +02:00
38 lines
588 B
Go
38 lines
588 B
Go
package article
|
|
|
|
import "time"
|
|
|
|
type Article struct {
|
|
ID uint32 `json:"id"`
|
|
Title string `json:"title"`
|
|
Body string `json:"body"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func FromApi(
|
|
title string,
|
|
body string,
|
|
) Article {
|
|
return Article{
|
|
Title: title,
|
|
Body: body,
|
|
}
|
|
}
|
|
|
|
func FromDb(
|
|
id uint32,
|
|
title string,
|
|
body string,
|
|
createdAt time.Time,
|
|
updatedAt time.Time,
|
|
) Article {
|
|
return Article{
|
|
ID: id,
|
|
Title: title,
|
|
Body: body,
|
|
CreatedAt: createdAt,
|
|
UpdatedAt: updatedAt,
|
|
}
|
|
}
|