/
item.go
27 lines (23 loc) · 951 Bytes
/
item.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package domain
import (
"context"
"time"
"cloud.google.com/go/firestore"
)
// ItemRecord is item data
type ItemRecord struct {
ID string `json:"id" firestore:"id" binding:"required"`
UID string `json:"uid" firestore:"uid"`
Title string `json:"title" firestore:"title" binding:"required"`
Kind string `json:"kind" firestore:"kind" binding:"required"`
CreatedAt time.Time `json:"-" firestore:"createdAt"`
UpdatedAt time.Time `json:"-" firestore:"updatedAt"`
}
// ItemRepository is repository interface
type ItemRepository interface {
Create(ctx context.Context, f *firestore.Client, i ItemRecord) error
Update(ctx context.Context, f *firestore.Client, i ItemRecord) error
Delete(ctx context.Context, f *firestore.Client, i ItemRecord) error
FindByUID(ctx context.Context, f *firestore.Client, uid string) ([]ItemRecord, error)
DeleteByUID(ctx context.Context, f *firestore.Client, uid string) error
}