Skip to content

Commit dbaa5ab

Browse files
authored
Format tag
2 parents 083fe97 + e986240 commit dbaa5ab

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

app/book/bookrepo/repository.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/book/repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
//go:generate go tool gorm gen -i repository.go -o bookrepo
1212
type IBookRepo interface {
1313
// SELECT * FROM books LIMIT @limit OFFSET @offset
14-
ListBooks(ctx context.Context, limit int64, offset int64) (model.Books, error)
14+
ListBooks(ctx context.Context, limit int64, offset int64) ([]*model.Book, error)
1515

1616
// INSERT INTO books (id, created_at, updated_at, title, author, published_date, image_url, description) VALUES (@data.ID, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, @data.Title, @data.Author, @data.PublishedDate, @data.ImageURL, @data.Description)
1717
// RETURNING *

model/book.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ import (
66
"github.com/google/uuid"
77
)
88

9-
type (
10-
Books []*Book
11-
Book struct {
12-
ID uuid.UUID `json:"id" gorm:"primarykey"`
13-
Title string `json:"title"`
14-
Author string `json:"author"`
15-
PublishedDate time.Time `json:"published_date,format:'2006-01-02'"`
16-
ImageURL string `json:"image_url"`
17-
Description string `json:"description"`
18-
CreatedAt time.Time `json:"created_at,format:RFC3339" gorm:"autoCreateTime"`
19-
UpdatedAt time.Time `json:"updated_at,format:RFC3339" gorm:"autoUpdateTime"`
20-
}
21-
)
9+
type Book struct {
10+
ID uuid.UUID `json:"id" gorm:"primarykey"`
11+
Title string `json:"title"`
12+
Author string `json:"author"`
13+
PublishedDate time.Time `json:"published_date,format:'2006-01-02'"`
14+
ImageURL string `json:"image_url"`
15+
Description string `json:"description"`
16+
CreatedAt time.Time `json:"created_at,format:RFC3339" gorm:"autoCreateTime"`
17+
UpdatedAt time.Time `json:"updated_at,format:RFC3339" gorm:"autoUpdateTime"`
18+
}

0 commit comments

Comments
 (0)