model

package
v0.0.0-...-8d67cd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountData

type AccountData struct {
	ID     string         `json:"" gorm:"primary_key"`
	Name   string         `json:"name"`
	Events []AccountEvent `json:"events" gorm:"ForeignKey:AccountID"`
}

func (*AccountData) BeforeCreate

func (ad *AccountData) BeforeCreate() (err error)

Before creating, we append a CREATED event

func (*AccountData) BeforeUpdate

func (ad *AccountData) BeforeUpdate(scope *gorm.Scope) (err error)

BeforeUpdate uses the SetColumn method to append a UPDATED event

type AccountEvent

type AccountEvent struct {
	ID        string `json:"" gorm:"primary_key"`
	AccountID string `json:"-" gorm:"index"` // Don't serialize + index which is very important for performance.
	EventName string `json:"eventName"`
	Created   string `json:"created"`
}

AccountEvent defines a single event on an Account. Uses GORM.

type AccountImage

type AccountImage struct {
	ID       string `json:"id" gorm:"primary_key"`
	URL      string `json:"url"`
	ServedBy string `json:"servedBy"`
}

AccountImage with GORM ID

type EmailAddress

type EmailAddress string

EmailAddress is just a little experiment with go types.

func (EmailAddress) IsValid

func (e EmailAddress) IsValid() bool

IsValid is just a sample method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL