Documentation
¶
Index ¶
- Constants
- Variables
- func NewCSVDB(path string) (*csvDB, error)
- func SignSession(username string) string
- func VerifySession(session string) (string, bool)
- type Broker
- type DB
- type Event
- type FieldSchema
- type FieldType
- type Hook
- type Record
- type Resource
- type Schema
- type Server
- type Store
- func (s *Store) Authenticate(r *http.Request) (Resource, error)
- func (s *Store) AuthenticateBasic(username, password string) (Resource, error)
- func (s *Store) Authorize(resource, id, action string, user Resource) error
- func (s *Store) Close() error
- func (s *Store) Create(resource string, r Resource) (string, error)
- func (s *Store) Delete(resource, id string) error
- func (s *Store) Get(resource, id string) (Resource, error)
- func (s *Store) List(resource, sortBy string) ([]Resource, error)
- func (s *Store) Update(resource string, r Resource) error
Constants ¶
View Source
const (
UserKey string = "user"
)
Variables ¶
View Source
var HashPasswd = func(passwd, salt string) string { sum := sha256.Sum256([]byte(salt + passwd)) return base32.StdEncoding.EncodeToString(sum[:]) }
View Source
var ID = func() string { return rand.Text() }
View Source
var Salt = func() string { return rand.Text() }
View Source
var SessionKey = Salt()
Functions ¶
func SignSession ¶
func VerifySession ¶
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
func (*Broker) Unsubscribe ¶
Unsubscribe from a resource.
type FieldSchema ¶
type FieldSchema struct {
Resource string
Field string
Type FieldType
Min float64
Max float64
Regex string
}
func (FieldSchema) Validate ¶
func (field FieldSchema) Validate(v any) bool
type Schema ¶
type Schema []FieldSchema
Click to show internal directories.
Click to hide internal directories.