Documentation
¶
Index ¶
- func EventFilterByTenant(tenantID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func PresentationFilterByEvent(eventID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func PresentationFilterBySpeaker(speakerID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func SeriesFilterByTenant(tenantID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func SpeakerFilterByEvent(eventID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func UserFilterByTenant(tenantID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- type Event
- type EventDB
- func (m *EventDB) Add(ctx context.Context, model *Event) (*Event, error)
- func (m *EventDB) DB() interface{}
- func (m *EventDB) Delete(ctx context.Context, id int) error
- func (m *EventDB) Get(ctx context.Context, id int) (Event, error)
- func (m *EventDB) List(ctx context.Context) []Event
- func (m *EventDB) ListEvent(ctx context.Context, tenantID int) []*app.Event
- func (m *EventDB) OneEvent(ctx context.Context, id int, tenantID int) (*app.Event, error)
- func (m *EventDB) TableName() string
- func (m *EventDB) Update(ctx context.Context, model *Event) error
- func (m *EventDB) UpdateFromCreateEventPayload(ctx context.Context, payload *app.CreateEventPayload, id int) error
- func (m *EventDB) UpdateFromUpdateEventPayload(ctx context.Context, payload *app.UpdateEventPayload, id int) error
- type EventStorage
- type Login
- type Presentation
- type PresentationDB
- func (m *PresentationDB) Add(ctx context.Context, model *Presentation) (*Presentation, error)
- func (m *PresentationDB) DB() interface{}
- func (m *PresentationDB) Delete(ctx context.Context, id int) error
- func (m *PresentationDB) Get(ctx context.Context, id int) (Presentation, error)
- func (m *PresentationDB) List(ctx context.Context) []Presentation
- func (m *PresentationDB) ListPresentation(ctx context.Context, eventID int, speakerID int) []*app.Presentation
- func (m *PresentationDB) ListPresentationAdmin(ctx context.Context, eventID int, speakerID int) []*app.PresentationAdmin
- func (m *PresentationDB) OnePresentation(ctx context.Context, id int, eventID int, speakerID int) (*app.Presentation, error)
- func (m *PresentationDB) OnePresentationAdmin(ctx context.Context, id int, eventID int, speakerID int) (*app.PresentationAdmin, error)
- func (m *PresentationDB) TableName() string
- func (m *PresentationDB) Update(ctx context.Context, model *Presentation) error
- func (m *PresentationDB) UpdateFromCreatePresentationPayload(ctx context.Context, payload *app.CreatePresentationPayload, id int) error
- func (m *PresentationDB) UpdateFromUpdatePresentationPayload(ctx context.Context, payload *app.UpdatePresentationPayload, id int) error
- type PresentationStorage
- type Series
- type SeriesDB
- func (m *SeriesDB) Add(ctx context.Context, model *Series) (*Series, error)
- func (m *SeriesDB) DB() interface{}
- func (m *SeriesDB) Delete(ctx context.Context, id int) error
- func (m *SeriesDB) Get(ctx context.Context, id int) (Series, error)
- func (m *SeriesDB) List(ctx context.Context) []Series
- func (m *SeriesDB) ListSeries(ctx context.Context, tenantID int) []*app.Series
- func (m *SeriesDB) OneSeries(ctx context.Context, id int, tenantID int) (*app.Series, error)
- func (m *SeriesDB) TableName() string
- func (m *SeriesDB) Update(ctx context.Context, model *Series) error
- func (m *SeriesDB) UpdateFromCreateSeriesPayload(ctx context.Context, payload *app.CreateSeriesPayload, id int) error
- func (m *SeriesDB) UpdateFromUpdateSeriesPayload(ctx context.Context, payload *app.UpdateSeriesPayload, id int) error
- type SeriesStorage
- type Speaker
- type SpeakerDB
- func (m *SpeakerDB) Add(ctx context.Context, model *Speaker) (*Speaker, error)
- func (m *SpeakerDB) DB() interface{}
- func (m *SpeakerDB) Delete(ctx context.Context, id int) error
- func (m *SpeakerDB) Get(ctx context.Context, id int) (Speaker, error)
- func (m *SpeakerDB) List(ctx context.Context) []Speaker
- func (m *SpeakerDB) ListSpeaker(ctx context.Context, eventID int) []*app.Speaker
- func (m *SpeakerDB) ListSpeakerAdmin(ctx context.Context, eventID int) []*app.SpeakerAdmin
- func (m *SpeakerDB) ListSpeakerLink(ctx context.Context, eventID int) []*app.SpeakerLink
- func (m *SpeakerDB) OneSpeaker(ctx context.Context, id int, eventID int) (*app.Speaker, error)
- func (m *SpeakerDB) OneSpeakerAdmin(ctx context.Context, id int, eventID int) (*app.SpeakerAdmin, error)
- func (m *SpeakerDB) OneSpeakerLink(ctx context.Context, id int, eventID int) (*app.SpeakerLink, error)
- func (m *SpeakerDB) TableName() string
- func (m *SpeakerDB) Update(ctx context.Context, model *Speaker) error
- func (m *SpeakerDB) UpdateFromCreateSpeakerPayload(ctx context.Context, payload *app.CreateSpeakerPayload, id int) error
- func (m *SpeakerDB) UpdateFromUpdateSpeakerPayload(ctx context.Context, payload *app.UpdateSpeakerPayload, id int) error
- type SpeakerStorage
- type Tenant
- type TenantDB
- func (m *TenantDB) Add(ctx context.Context, model *Tenant) (*Tenant, error)
- func (m *TenantDB) DB() interface{}
- func (m *TenantDB) Delete(ctx context.Context, id int) error
- func (m *TenantDB) Get(ctx context.Context, id int) (Tenant, error)
- func (m *TenantDB) List(ctx context.Context) []Tenant
- func (m *TenantDB) ListTenant(ctx context.Context) []*app.Tenant
- func (m *TenantDB) OneTenant(ctx context.Context, id int) (*app.Tenant, error)
- func (m *TenantDB) TableName() string
- func (m *TenantDB) Update(ctx context.Context, model *Tenant) error
- func (m *TenantDB) UpdateFromCreateTenantPayload(ctx context.Context, payload *app.CreateTenantPayload, id int) error
- func (m *TenantDB) UpdateFromUpdateTenantPayload(ctx context.Context, payload *app.UpdateTenantPayload, id int) error
- type TenantStorage
- type User
- type UserDB
- func (m *UserDB) Add(ctx context.Context, model *User) (*User, error)
- func (m *UserDB) DB() interface{}
- func (m *UserDB) Delete(ctx context.Context, id int) error
- func (m *UserDB) Get(ctx context.Context, id int) (User, error)
- func (m *UserDB) GetByLogin(ctx context.Context, l Login) (User, error)
- func (m *UserDB) List(ctx context.Context) []User
- func (m *UserDB) ListUser(ctx context.Context, tenantID int) []*app.User
- func (m *UserDB) ListUserLink(ctx context.Context, tenantID int) []*app.UserLink
- func (m *UserDB) ListUserTenant(ctx context.Context, tenantID int) []*app.UserTenant
- func (m *UserDB) OneUser(ctx context.Context, id int, tenantID int) (*app.User, error)
- func (m *UserDB) OneUserLink(ctx context.Context, id int, tenantID int) (*app.UserLink, error)
- func (m *UserDB) OneUserTenant(ctx context.Context, id int, tenantID int) (*app.UserTenant, error)
- func (m *UserDB) TableName() string
- func (m *UserDB) Update(ctx context.Context, model *User) error
- func (m *UserDB) UpdateFromCreateAdminuserPayload(ctx context.Context, payload *app.CreateAdminuserPayload, id int) error
- func (m *UserDB) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, id int) error
- func (m *UserDB) UpdateFromUpdateAdminuserPayload(ctx context.Context, payload *app.UpdateAdminuserPayload, id int) error
- func (m *UserDB) UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, id int) error
- type UserStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventFilterByTenant ¶
EventFilterByTenant is a gorm filter for a Belongs To relationship.
func PresentationFilterByEvent ¶
PresentationFilterByEvent is a gorm filter for a Belongs To relationship.
func PresentationFilterBySpeaker ¶
PresentationFilterBySpeaker is a gorm filter for a Belongs To relationship.
func SeriesFilterByTenant ¶
SeriesFilterByTenant is a gorm filter for a Belongs To relationship.
func SpeakerFilterByEvent ¶
SpeakerFilterByEvent is a gorm filter for a Belongs To relationship.
Types ¶
type Event ¶
type Event struct { ID int `gorm:"primary_key"` // This is the ID PK field CreatedAt time.Time DeletedAt *time.Time EndDate *time.Time Name string Presentations []Presentation // has many Presentations Speakers []Speaker // has many Speakers StartDate *time.Time TenantID int // has many Event URL *string UpdatedAt time.Time Tenant Tenant }
This is the Event model
func EventFromCreateEventPayload ¶
func EventFromCreateEventPayload(payload *app.CreateEventPayload) *Event
EventFromCreateEventPayload Converts source CreateEventPayload to target Event model only copying the non-nil fields from the source.
func EventFromUpdateEventPayload ¶
func EventFromUpdateEventPayload(payload *app.UpdateEventPayload) *Event
EventFromUpdateEventPayload Converts source UpdateEventPayload to target Event model only copying the non-nil fields from the source.
func (*Event) EventToEvent ¶
EventToEvent returns the Event representation of Event.
type EventDB ¶
EventDB is the implementation of the storage interface for Event.
func (*EventDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*EventDB) Get ¶
Get returns a single Event as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*EventDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*EventDB) UpdateFromCreateEventPayload ¶
func (m *EventDB) UpdateFromCreateEventPayload(ctx context.Context, payload *app.CreateEventPayload, id int) error
UpdateFromCreateEventPayload applies non-nil changes from CreateEventPayload to the model and saves it
func (*EventDB) UpdateFromUpdateEventPayload ¶
func (m *EventDB) UpdateFromUpdateEventPayload(ctx context.Context, payload *app.UpdateEventPayload, id int) error
UpdateFromUpdateEventPayload applies non-nil changes from UpdateEventPayload to the model and saves it
type EventStorage ¶
type EventStorage interface { DB() interface{} List(ctx context.Context) []Event Get(ctx context.Context, id int) (Event, error) Add(ctx context.Context, event *Event) (*Event, error) Update(ctx context.Context, event *Event) error Delete(ctx context.Context, id int) error ListEvent(ctx context.Context, tenantID int) []*app.Event OneEvent(ctx context.Context, id int, tenantID int) (*app.Event, error) UpdateFromCreateEventPayload(ctx context.Context, payload *app.CreateEventPayload, id int) error UpdateFromUpdateEventPayload(ctx context.Context, payload *app.UpdateEventPayload, id int) error }
EventStorage represents the storage interface.
type Login ¶
func (u *User) AfterCreate() error { if *u.Validated { return nil } go u.ValidationEmail() return nil }
func (u *User) ValidationEmail() error { sg := sendgrid.NewSendGridClientWithApiKey("") message := sendgrid.NewMail() message.AddTo(u.Email) message.AddToName(u.FirstName + " " + u.LastName) message.SetSubject("Validate your account") msg := fmt.Sprintf("<html><body>Welcome.<br/><br/>Please click <a href='<validationurl>validaate_email?u=%d&validation=%s'>here</a> to validate your account.</body></html>", u.ID, *u.ValidationCode) message.SetHTML(msg) message.SetFrom(supportEmail) r := sg.Send(message) return r }
type Presentation ¶
type Presentation struct { ID int `gorm:"primary_key"` // This is the ID PK field Abstract string CreatedAt time.Time DeletedAt *time.Time Detail *string EventID int // Belongs To Event Name *string SpeakerID int // Belongs To Speaker UpdatedAt time.Time Event Event Speaker Speaker }
This is the presentation model
func PresentationFromCreatePresentationPayload ¶
func PresentationFromCreatePresentationPayload(payload *app.CreatePresentationPayload) *Presentation
PresentationFromCreatePresentationPayload Converts source CreatePresentationPayload to target Presentation model only copying the non-nil fields from the source.
func PresentationFromUpdatePresentationPayload ¶
func PresentationFromUpdatePresentationPayload(payload *app.UpdatePresentationPayload) *Presentation
PresentationFromUpdatePresentationPayload Converts source UpdatePresentationPayload to target Presentation model only copying the non-nil fields from the source.
func (*Presentation) PresentationToPresentation ¶
func (m *Presentation) PresentationToPresentation() *app.Presentation
PresentationToPresentation returns the Presentation representation of Presentation.
func (*Presentation) PresentationToPresentationAdmin ¶
func (m *Presentation) PresentationToPresentationAdmin() *app.PresentationAdmin
PresentationToPresentationAdmin returns the Presentation representation of Presentation.
func (Presentation) TableName ¶
func (m Presentation) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
type PresentationDB ¶
PresentationDB is the implementation of the storage interface for Presentation.
func NewPresentationDB ¶
func NewPresentationDB(db gorm.DB) *PresentationDB
NewPresentationDB creates a new storage type.
func (*PresentationDB) Add ¶
func (m *PresentationDB) Add(ctx context.Context, model *Presentation) (*Presentation, error)
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*PresentationDB) DB ¶
func (m *PresentationDB) DB() interface{}
DB returns the underlying database.
func (*PresentationDB) Delete ¶
func (m *PresentationDB) Delete(ctx context.Context, id int) error
Delete removes a single record.
func (*PresentationDB) Get ¶
func (m *PresentationDB) Get(ctx context.Context, id int) (Presentation, error)
Get returns a single Presentation as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*PresentationDB) List ¶
func (m *PresentationDB) List(ctx context.Context) []Presentation
List returns an array of Presentation
func (*PresentationDB) ListPresentation ¶
func (m *PresentationDB) ListPresentation(ctx context.Context, eventID int, speakerID int) []*app.Presentation
ListPresentation returns an array of view: default.
func (*PresentationDB) ListPresentationAdmin ¶
func (m *PresentationDB) ListPresentationAdmin(ctx context.Context, eventID int, speakerID int) []*app.PresentationAdmin
ListPresentationAdmin returns an array of view: admin.
func (*PresentationDB) OnePresentation ¶
func (m *PresentationDB) OnePresentation(ctx context.Context, id int, eventID int, speakerID int) (*app.Presentation, error)
OnePresentation returns an array of view: default.
func (*PresentationDB) OnePresentationAdmin ¶
func (m *PresentationDB) OnePresentationAdmin(ctx context.Context, id int, eventID int, speakerID int) (*app.PresentationAdmin, error)
OnePresentationAdmin returns an array of view: admin.
func (*PresentationDB) TableName ¶
func (m *PresentationDB) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*PresentationDB) Update ¶
func (m *PresentationDB) Update(ctx context.Context, model *Presentation) error
Update modifies a single record.
func (*PresentationDB) UpdateFromCreatePresentationPayload ¶
func (m *PresentationDB) UpdateFromCreatePresentationPayload(ctx context.Context, payload *app.CreatePresentationPayload, id int) error
UpdateFromCreatePresentationPayload applies non-nil changes from CreatePresentationPayload to the model and saves it
func (*PresentationDB) UpdateFromUpdatePresentationPayload ¶
func (m *PresentationDB) UpdateFromUpdatePresentationPayload(ctx context.Context, payload *app.UpdatePresentationPayload, id int) error
UpdateFromUpdatePresentationPayload applies non-nil changes from UpdatePresentationPayload to the model and saves it
type PresentationStorage ¶
type PresentationStorage interface { DB() interface{} List(ctx context.Context) []Presentation Get(ctx context.Context, id int) (Presentation, error) Add(ctx context.Context, presentation *Presentation) (*Presentation, error) Update(ctx context.Context, presentation *Presentation) error Delete(ctx context.Context, id int) error ListPresentationAdmin(ctx context.Context, eventID int, speakerID int) []*app.PresentationAdmin OnePresentationAdmin(ctx context.Context, id int, eventID int, speakerID int) (*app.PresentationAdmin, error) ListPresentation(ctx context.Context, eventID int, speakerID int) []*app.Presentation OnePresentation(ctx context.Context, id int, eventID int, speakerID int) (*app.Presentation, error) UpdateFromCreatePresentationPayload(ctx context.Context, payload *app.CreatePresentationPayload, id int) error UpdateFromUpdatePresentationPayload(ctx context.Context, payload *app.UpdatePresentationPayload, id int) error }
PresentationStorage represents the storage interface.
type Series ¶
type Series struct { ID int `gorm:"primary_key"` // This is the ID PK field CreatedAt time.Time DeletedAt *time.Time Name string TenantID int // Belongs To Tenant UpdatedAt time.Time Tenant Tenant }
This is the Series model
func SeriesFromCreateSeriesPayload ¶
func SeriesFromCreateSeriesPayload(payload *app.CreateSeriesPayload) *Series
SeriesFromCreateSeriesPayload Converts source CreateSeriesPayload to target Series model only copying the non-nil fields from the source.
func SeriesFromUpdateSeriesPayload ¶
func SeriesFromUpdateSeriesPayload(payload *app.UpdateSeriesPayload) *Series
SeriesFromUpdateSeriesPayload Converts source UpdateSeriesPayload to target Series model only copying the non-nil fields from the source.
func (*Series) SeriesToSeries ¶
SeriesToSeries returns the Series representation of Series.
type SeriesDB ¶
SeriesDB is the implementation of the storage interface for Series.
func (*SeriesDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*SeriesDB) Get ¶
Get returns a single Series as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*SeriesDB) ListSeries ¶
ListSeries returns an array of view: default.
func (*SeriesDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*SeriesDB) UpdateFromCreateSeriesPayload ¶
func (m *SeriesDB) UpdateFromCreateSeriesPayload(ctx context.Context, payload *app.CreateSeriesPayload, id int) error
UpdateFromCreateSeriesPayload applies non-nil changes from CreateSeriesPayload to the model and saves it
func (*SeriesDB) UpdateFromUpdateSeriesPayload ¶
func (m *SeriesDB) UpdateFromUpdateSeriesPayload(ctx context.Context, payload *app.UpdateSeriesPayload, id int) error
UpdateFromUpdateSeriesPayload applies non-nil changes from UpdateSeriesPayload to the model and saves it
type SeriesStorage ¶
type SeriesStorage interface { DB() interface{} List(ctx context.Context) []Series Get(ctx context.Context, id int) (Series, error) Add(ctx context.Context, series *Series) (*Series, error) Update(ctx context.Context, series *Series) error Delete(ctx context.Context, id int) error ListSeries(ctx context.Context, tenantID int) []*app.Series OneSeries(ctx context.Context, id int, tenantID int) (*app.Series, error) UpdateFromCreateSeriesPayload(ctx context.Context, payload *app.CreateSeriesPayload, id int) error UpdateFromUpdateSeriesPayload(ctx context.Context, payload *app.UpdateSeriesPayload, id int) error }
SeriesStorage represents the storage interface.
type Speaker ¶
type Speaker struct { ID int `gorm:"primary_key"` // This is the ID PK field Bio *string CreatedAt time.Time DeletedAt *time.Time EventID int // Belongs To Event FirstName string Github *string ImageURL *string LastName string Linkedin *string Twitter *string UpdatedAt time.Time Event Event }
This is the Speaker model
func SpeakerFromCreateSpeakerPayload ¶
func SpeakerFromCreateSpeakerPayload(payload *app.CreateSpeakerPayload) *Speaker
SpeakerFromCreateSpeakerPayload Converts source CreateSpeakerPayload to target Speaker model only copying the non-nil fields from the source.
func SpeakerFromUpdateSpeakerPayload ¶
func SpeakerFromUpdateSpeakerPayload(payload *app.UpdateSpeakerPayload) *Speaker
SpeakerFromUpdateSpeakerPayload Converts source UpdateSpeakerPayload to target Speaker model only copying the non-nil fields from the source.
func (*Speaker) SpeakerToSpeaker ¶
SpeakerToSpeaker returns the Speaker representation of Speaker.
func (*Speaker) SpeakerToSpeakerAdmin ¶
func (m *Speaker) SpeakerToSpeakerAdmin() *app.SpeakerAdmin
SpeakerToSpeakerAdmin returns the Speaker representation of Speaker.
func (*Speaker) SpeakerToSpeakerLink ¶
func (m *Speaker) SpeakerToSpeakerLink() *app.SpeakerLink
SpeakerToSpeakerLink returns the Speaker representation of Speaker.
type SpeakerDB ¶
SpeakerDB is the implementation of the storage interface for Speaker.
func NewSpeakerDB ¶
NewSpeakerDB creates a new storage type.
func (*SpeakerDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*SpeakerDB) Get ¶
Get returns a single Speaker as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*SpeakerDB) ListSpeaker ¶
ListSpeaker returns an array of view: default.
func (*SpeakerDB) ListSpeakerAdmin ¶
ListSpeakerAdmin returns an array of view: admin.
func (*SpeakerDB) ListSpeakerLink ¶
ListSpeakerLink returns an array of view: link.
func (*SpeakerDB) OneSpeaker ¶
OneSpeaker returns an array of view: default.
func (*SpeakerDB) OneSpeakerAdmin ¶
func (m *SpeakerDB) OneSpeakerAdmin(ctx context.Context, id int, eventID int) (*app.SpeakerAdmin, error)
OneSpeakerAdmin returns an array of view: admin.
func (*SpeakerDB) OneSpeakerLink ¶
func (m *SpeakerDB) OneSpeakerLink(ctx context.Context, id int, eventID int) (*app.SpeakerLink, error)
OneSpeakerLink returns an array of view: link.
func (*SpeakerDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*SpeakerDB) UpdateFromCreateSpeakerPayload ¶
func (m *SpeakerDB) UpdateFromCreateSpeakerPayload(ctx context.Context, payload *app.CreateSpeakerPayload, id int) error
UpdateFromCreateSpeakerPayload applies non-nil changes from CreateSpeakerPayload to the model and saves it
func (*SpeakerDB) UpdateFromUpdateSpeakerPayload ¶
func (m *SpeakerDB) UpdateFromUpdateSpeakerPayload(ctx context.Context, payload *app.UpdateSpeakerPayload, id int) error
UpdateFromUpdateSpeakerPayload applies non-nil changes from UpdateSpeakerPayload to the model and saves it
type SpeakerStorage ¶
type SpeakerStorage interface { DB() interface{} List(ctx context.Context) []Speaker Get(ctx context.Context, id int) (Speaker, error) Add(ctx context.Context, speaker *Speaker) (*Speaker, error) Update(ctx context.Context, speaker *Speaker) error Delete(ctx context.Context, id int) error ListSpeakerAdmin(ctx context.Context, eventID int) []*app.SpeakerAdmin OneSpeakerAdmin(ctx context.Context, id int, eventID int) (*app.SpeakerAdmin, error) ListSpeaker(ctx context.Context, eventID int) []*app.Speaker OneSpeaker(ctx context.Context, id int, eventID int) (*app.Speaker, error) ListSpeakerLink(ctx context.Context, eventID int) []*app.SpeakerLink OneSpeakerLink(ctx context.Context, id int, eventID int) (*app.SpeakerLink, error) UpdateFromCreateSpeakerPayload(ctx context.Context, payload *app.CreateSpeakerPayload, id int) error UpdateFromUpdateSpeakerPayload(ctx context.Context, payload *app.UpdateSpeakerPayload, id int) error }
SpeakerStorage represents the storage interface.
type Tenant ¶
type Tenant struct { ID int `gorm:"primary_key"` // This is the ID PK field CreatedAt time.Time DeletedAt *time.Time Events []Event // has many Events Name string UpdatedAt time.Time Users []User // has many Users }
This is the Tenant model
func TenantFromCreateTenantPayload ¶
func TenantFromCreateTenantPayload(payload *app.CreateTenantPayload) *Tenant
TenantFromCreateTenantPayload Converts source CreateTenantPayload to target Tenant model only copying the non-nil fields from the source.
func TenantFromUpdateTenantPayload ¶
func TenantFromUpdateTenantPayload(payload *app.UpdateTenantPayload) *Tenant
TenantFromUpdateTenantPayload Converts source UpdateTenantPayload to target Tenant model only copying the non-nil fields from the source.
func (Tenant) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*Tenant) TenantToTenant ¶
TenantToTenant returns the Tenant representation of Tenant.
type TenantDB ¶
TenantDB is the implementation of the storage interface for Tenant.
func (*TenantDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*TenantDB) Get ¶
Get returns a single Tenant as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*TenantDB) ListTenant ¶
ListTenant returns an array of view: default.
func (*TenantDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*TenantDB) UpdateFromCreateTenantPayload ¶
func (m *TenantDB) UpdateFromCreateTenantPayload(ctx context.Context, payload *app.CreateTenantPayload, id int) error
UpdateFromCreateTenantPayload applies non-nil changes from CreateTenantPayload to the model and saves it
func (*TenantDB) UpdateFromUpdateTenantPayload ¶
func (m *TenantDB) UpdateFromUpdateTenantPayload(ctx context.Context, payload *app.UpdateTenantPayload, id int) error
UpdateFromUpdateTenantPayload applies non-nil changes from UpdateTenantPayload to the model and saves it
type TenantStorage ¶
type TenantStorage interface { DB() interface{} List(ctx context.Context) []Tenant Get(ctx context.Context, id int) (Tenant, error) Add(ctx context.Context, tenant *Tenant) (*Tenant, error) Update(ctx context.Context, tenant *Tenant) error Delete(ctx context.Context, id int) error ListTenant(ctx context.Context) []*app.Tenant OneTenant(ctx context.Context, id int) (*app.Tenant, error) UpdateFromCreateTenantPayload(ctx context.Context, payload *app.CreateTenantPayload, id int) error UpdateFromUpdateTenantPayload(ctx context.Context, payload *app.UpdateTenantPayload, id int) error }
TenantStorage represents the storage interface.
type User ¶
type User struct { ID int `gorm:"primary_key"` // This is the ID PK field CreatedAt time.Time DeletedAt *time.Time Email string FirstName string `gorm:"column:firstname"` Href string LastName string `gorm:"column:lastname"` Password string Role string TenantID int // Belongs To Tenant UpdatedAt time.Time Validated *bool ValidationCode *string Tenant Tenant }
This is the User model
func UserFromCreateAdminuserPayload ¶
func UserFromCreateAdminuserPayload(payload *app.CreateAdminuserPayload) *User
UserFromCreateAdminuserPayload Converts source CreateAdminuserPayload to target User model only copying the non-nil fields from the source.
func UserFromCreateUserPayload ¶
func UserFromCreateUserPayload(payload *app.CreateUserPayload) *User
UserFromCreateUserPayload Converts source CreateUserPayload to target User model only copying the non-nil fields from the source.
func UserFromUpdateAdminuserPayload ¶
func UserFromUpdateAdminuserPayload(payload *app.UpdateAdminuserPayload) *User
UserFromUpdateAdminuserPayload Converts source UpdateAdminuserPayload to target User model only copying the non-nil fields from the source.
func UserFromUpdateUserPayload ¶
func UserFromUpdateUserPayload(payload *app.UpdateUserPayload) *User
UserFromUpdateUserPayload Converts source UpdateUserPayload to target User model only copying the non-nil fields from the source.
func (*User) BeforeCreate ¶
TODO: Gorm changed something here, what is it?
func (User) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*User) UserToUser ¶
UserToUser returns the User representation of User.
func (*User) UserToUserLink ¶
UserToUserLink returns the User representation of User.
func (*User) UserToUserTenant ¶
func (m *User) UserToUserTenant() *app.UserTenant
UserToUserTenant returns the User representation of User.
type UserDB ¶
UserDB is the implementation of the storage interface for User.
func (*UserDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*UserDB) Get ¶
Get returns a single User as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*UserDB) ListUserLink ¶
ListUserLink returns an array of view: link.
func (*UserDB) ListUserTenant ¶
ListUserTenant returns an array of view: tenant.
func (*UserDB) OneUserLink ¶
OneUserLink returns an array of view: link.
func (*UserDB) OneUserTenant ¶
OneUserTenant returns an array of view: tenant.
func (*UserDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*UserDB) UpdateFromCreateAdminuserPayload ¶
func (m *UserDB) UpdateFromCreateAdminuserPayload(ctx context.Context, payload *app.CreateAdminuserPayload, id int) error
UpdateFromCreateAdminuserPayload applies non-nil changes from CreateAdminuserPayload to the model and saves it
func (*UserDB) UpdateFromCreateUserPayload ¶
func (m *UserDB) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, id int) error
UpdateFromCreateUserPayload applies non-nil changes from CreateUserPayload to the model and saves it
func (*UserDB) UpdateFromUpdateAdminuserPayload ¶
func (m *UserDB) UpdateFromUpdateAdminuserPayload(ctx context.Context, payload *app.UpdateAdminuserPayload, id int) error
UpdateFromUpdateAdminuserPayload applies non-nil changes from UpdateAdminuserPayload to the model and saves it
func (*UserDB) UpdateFromUpdateUserPayload ¶
func (m *UserDB) UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, id int) error
UpdateFromUpdateUserPayload applies non-nil changes from UpdateUserPayload to the model and saves it
type UserStorage ¶
type UserStorage interface { DB() interface{} List(ctx context.Context) []User Get(ctx context.Context, id int) (User, error) Add(ctx context.Context, user *User) (*User, error) Update(ctx context.Context, user *User) error Delete(ctx context.Context, id int) error ListUser(ctx context.Context, tenantID int) []*app.User OneUser(ctx context.Context, id int, tenantID int) (*app.User, error) ListUserLink(ctx context.Context, tenantID int) []*app.UserLink OneUserLink(ctx context.Context, id int, tenantID int) (*app.UserLink, error) ListUserTenant(ctx context.Context, tenantID int) []*app.UserTenant OneUserTenant(ctx context.Context, id int, tenantID int) (*app.UserTenant, error) UpdateFromCreateAdminuserPayload(ctx context.Context, payload *app.CreateAdminuserPayload, id int) error UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, id int) error UpdateFromUpdateAdminuserPayload(ctx context.Context, payload *app.UpdateAdminuserPayload, id int) error UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, id int) error }
UserStorage represents the storage interface.