29 lines
587 B
Go
29 lines
587 B
Go
// pkg/models/models.go
|
|
package models
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
"time"
|
|
)
|
|
|
|
type Collection struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
System bool `json:"system"`
|
|
}
|
|
|
|
type Record struct {
|
|
ID string `json:"id"`
|
|
CollectionID string `json:"collectionId"`
|
|
Created time.Time `json:"created"`
|
|
Updated time.Time `json:"updated"`
|
|
Data map[string]interface{} `json:"data"`
|
|
}
|
|
|
|
func NewID() string {
|
|
b := make([]byte, 6)
|
|
rand.Read(b)
|
|
return hex.EncodeToString(b)
|
|
}
|