Documentation ¶
Overview ¶
Based on: http://www.booneputney.com/development/gorm-golang-jsonb-value-copy/ Therefore credit is due to Boone Putney. Thank you!
Very heavily inspired by https://github.com/nferruzzi/gormGIS Therefore credit is due to nferruzzi. Thank you!
Index ¶
- Constants
- func AddDefaultData(db *gorm.DB)
- func InitDB() *gorm.DB
- func NotificationReaper(db *gorm.DB, expiryOffset time.Duration, sleepOffset time.Duration)
- func OfferRequestReaper(db *gorm.DB, table string, sleepOffset time.Duration)
- type GeoPolygon
- type Group
- type Matching
- type MatchingScore
- type Notification
- type Offer
- type OffersByUUID
- type PhoneNumbers
- type Region
- type Request
- type RequestsByUUID
- type Tag
- type TagsByName
- type User
Constants ¶
View Source
const (
NotificationMatching string = "matching"
)
Variables ¶
This section is empty.
Functions ¶
func AddDefaultData ¶
Insert default data into Permissions, Groups and Tags table
func NotificationReaper ¶
For notifications.
Types ¶
type GeoPolygon ¶
func (*GeoPolygon) Scan ¶
func (p *GeoPolygon) Scan(val interface{}) error
type Matching ¶
type Matching struct { ID string `gorm:"primary_key"` RegionId string `gorm:"index;not null"` Region Region `gorm:"ForeignKey:RegionId;AssociationForeignKey:Refer"` OfferId string `gorm:"index;not null"` Offer Offer `gorm:"ForeignKey:OfferId;AssociationForeignKey:Refer"` RequestId string `gorm:"index;not null"` Request Request `gorm:"ForeignKey:RequestId;AssociationForeignKey:Refer"` Invalid bool `gorm:"not null"` }
type MatchingScore ¶
type MatchingScore struct { RegionID string `gorm:"primary_key"` Region Region `gorm:"ForeignKey:RegionID;AssociationForeignKey:Refer"` OfferID string `gorm:"primary_key"` Offer Offer `gorm:"ForeignKey:OfferID;AssociationForeignKey:Refer"` RequestID string `gorm:"primary_key"` Request Request `gorm:"ForeignKey:RequestID;AssociationForeignKey:Refer"` MatchingScore float64 `gorm:"not null"` Recommended bool }
type Notification ¶
type Offer ¶
type Offer struct { ID string `gorm:"primary_key"` Name string `gorm:"index;not null"` UserID string `gorm:"index;not null"` User User `gorm:"ForeignKey:UserID;AssociationForeignKey:Refer"` Location gormGIS.GeoPoint `gorm:"not null" sql:"type:geometry(Geometry,4326)"` Radius float64 `gorm:"not null"` Tags []Tag `gorm:"many2many:offer_tags"` Description string Regions []Region `gorm:"many2many:region_offers"` ValidityPeriod time.Time `gorm:"not null"` Matched bool `gorm:"not null"` Expired bool `gorm:"not null"` }
type OffersByUUID ¶
type OffersByUUID []Offer
Make offers list sortable.
func (OffersByUUID) Len ¶
func (o OffersByUUID) Len() int
func (OffersByUUID) Less ¶
func (o OffersByUUID) Less(i, j int) bool
func (OffersByUUID) Swap ¶
func (o OffersByUUID) Swap(i, j int)
type PhoneNumbers ¶
type PhoneNumbers []string
func (*PhoneNumbers) Scan ¶
func (num *PhoneNumbers) Scan(value interface{}) error
type Region ¶
type Region struct { ID string `gorm:"primary_key"` Name string `gorm:"not null"` Boundaries GeoPolygon `gorm:"not null" sql:"type:geometry(Geometry,4326)"` Description string `gorm:"not null"` Matchings []Matching Offers []Offer `gorm:"many2many:region_offers"` Requests []Request `gorm:"many2many:region_requests"` RecommendationUpdated bool }
type Request ¶
type Request struct { ID string `gorm:"primary_key"` Name string `gorm:"index;not null"` UserID string `gorm:"index;not null"` User User `gorm:"ForeignKey:UserID;AssociationForeignKey:Refer"` Location gormGIS.GeoPoint `gorm:"not null" sql:"type:geometry(Geometry,4326)"` Radius float64 `gorm:"not null"` Tags []Tag `gorm:"many2many:request_tags"` Description string Regions []Region `gorm:"many2many:region_requests"` ValidityPeriod time.Time `gorm:"not null"` Matched bool `gorm:"not null"` Expired bool `gorm:"not null"` }
type RequestsByUUID ¶
type RequestsByUUID []Request
Make requests list sortable.
func (RequestsByUUID) Len ¶
func (r RequestsByUUID) Len() int
func (RequestsByUUID) Less ¶
func (r RequestsByUUID) Less(i, j int) bool
func (RequestsByUUID) Swap ¶
func (r RequestsByUUID) Swap(i, j int)
type TagsByName ¶
type TagsByName []Tag
Make tags list sortable.
func (TagsByName) Len ¶
func (t TagsByName) Len() int
func (TagsByName) Less ¶
func (t TagsByName) Less(i, j int) bool
func (TagsByName) Swap ¶
func (t TagsByName) Swap(i, j int)
type User ¶
type User struct { ID string `gorm:"primary_key"` Name string `gorm:"not null"` PreferredName string `gorm:"not null"` Mail string `gorm:"index;not null;unique"` MailVerified bool `gorm:"not null"` PhoneNumbers PhoneNumbers `gorm:"not null" sql:"type:jsonb"` PasswordHash string `gorm:"not null;unique"` Groups []Group `gorm:"many2many:user_groups"` Enabled bool `gorm:"not null"` }
Click to show internal directories.
Click to hide internal directories.