Create share table and repository. (#930)

* Add share table and repository

* Add datastore mock

* Try fixing indent

* Try fixing indent - 2

* Try fixing indent - 3

* Implement rest.Repository and rest.Persistance

* Renew date

* Better error handling

* Improve field name

* Fix json name conventionally
This commit is contained in:
Yash Jipkate
2021-05-30 21:20:35 +05:30
committed by GitHub
parent 675cbe11b3
commit 327c259a3d
6 changed files with 168 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package model
import (
"time"
)
type Share struct {
ID string `json:"id" orm:"column(id)"`
Name string `json:"name"`
Description string `json:"description"`
ExpiresAt time.Time `json:"expiresAt"`
CreatedAt time.Time `json:"createdAt"`
LastVisitedAt time.Time `json:"lastVisitedAt"`
ResourceIDs string `json:"resourceIds" orm:"column(resource_ids)"`
ResourceType string `json:"resourceType"`
VisitCount string `json:"visitCount"`
}
type Shares []Share
type ShareRepository interface {
Put(s *Share) error
GetAll(options ...QueryOptions) (Shares, error)
}