mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
36 lines
549 B
Go
36 lines
549 B
Go
package article
|
|
|
|
type Article struct {
|
|
Id int `json:"id"`
|
|
Title string `json:"title"`
|
|
Body string `json:"body"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
func FromApi(
|
|
title string,
|
|
body string,
|
|
) Article {
|
|
return Article{
|
|
Title: title,
|
|
Body: body,
|
|
}
|
|
}
|
|
|
|
func FromDb(
|
|
id int,
|
|
title string,
|
|
body string,
|
|
createdAt string,
|
|
updatedAt string,
|
|
) Article {
|
|
return Article{
|
|
Id: id,
|
|
Title: title,
|
|
Body: body,
|
|
CreatedAt: createdAt,
|
|
UpdatedAt: updatedAt,
|
|
}
|
|
}
|