Documentation ¶
Index ¶
- func ProposalFilterByUser(userID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func ReviewFilterByProposal(proposalID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- func ReviewFilterByUser(userID int, originaldb *gorm.DB) func(db *gorm.DB) *gorm.DB
- type Proposal
- type ProposalDB
- func (m *ProposalDB) Add(ctx context.Context, model *Proposal) (*Proposal, error)
- func (m *ProposalDB) DB() interface{}
- func (m *ProposalDB) Delete(ctx context.Context, id int) error
- func (m *ProposalDB) Get(ctx context.Context, id int) (Proposal, error)
- func (m *ProposalDB) List(ctx context.Context) []Proposal
- func (m *ProposalDB) ListProposal(ctx context.Context, userID int) []*app.Proposal
- func (m *ProposalDB) ListProposalLink(ctx context.Context, userID int) []*app.ProposalLink
- func (m *ProposalDB) OneProposal(ctx context.Context, id int, userID int) (*app.Proposal, error)
- func (m *ProposalDB) OneProposalLink(ctx context.Context, id int, userID int) (*app.ProposalLink, error)
- func (m *ProposalDB) TableName() string
- func (m *ProposalDB) Update(ctx context.Context, model *Proposal) error
- func (m *ProposalDB) UpdateFromCreateProposalPayload(ctx context.Context, payload *app.CreateProposalPayload, id int) error
- func (m *ProposalDB) UpdateFromUpdateProposalPayload(ctx context.Context, payload *app.UpdateProposalPayload, id int) error
- type ProposalStorage
- type Review
- type ReviewDB
- func (m *ReviewDB) Add(ctx context.Context, model *Review) (*Review, error)
- func (m *ReviewDB) DB() interface{}
- func (m *ReviewDB) Delete(ctx context.Context, id int) error
- func (m *ReviewDB) Get(ctx context.Context, id int) (Review, error)
- func (m *ReviewDB) List(ctx context.Context) []Review
- func (m *ReviewDB) ListReview(ctx context.Context, proposalID int, userID int) []*app.Review
- func (m *ReviewDB) ListReviewLink(ctx context.Context, proposalID int, userID int) []*app.ReviewLink
- func (m *ReviewDB) OneReview(ctx context.Context, id int, proposalID int, userID int) (*app.Review, error)
- func (m *ReviewDB) OneReviewLink(ctx context.Context, id int, proposalID int, userID int) (*app.ReviewLink, error)
- func (m *ReviewDB) TableName() string
- func (m *ReviewDB) Update(ctx context.Context, model *Review) error
- func (m *ReviewDB) UpdateFromCreateReviewPayload(ctx context.Context, payload *app.CreateReviewPayload, id int) error
- func (m *ReviewDB) UpdateFromUpdateReviewPayload(ctx context.Context, payload *app.UpdateReviewPayload, id int) error
- type ReviewStorage
- type Test
- type TestDB
- func (m *TestDB) Add(ctx context.Context, model *Test) (*Test, error)
- func (m *TestDB) DB() interface{}
- func (m *TestDB) Delete(ctx context.Context) error
- func (m *TestDB) Get(ctx context.Context) (Test, error)
- func (m *TestDB) List(ctx context.Context) []Test
- func (m *TestDB) TableName() string
- func (m *TestDB) Update(ctx context.Context, model *Test) error
- type TestStorage
- type TestToo
- type TestTooDB
- func (m *TestTooDB) Add(ctx context.Context, model *TestToo) (*TestToo, error)
- func (m *TestTooDB) DB() interface{}
- func (m *TestTooDB) Delete(ctx context.Context, idone int, idtwo int) error
- func (m *TestTooDB) Get(ctx context.Context, idone int, idtwo int) (TestToo, error)
- func (m *TestTooDB) List(ctx context.Context) []TestToo
- func (m *TestTooDB) ListUser(ctx context.Context) []*app.User
- func (m *TestTooDB) ListUserLink(ctx context.Context) []*app.UserLink
- func (m *TestTooDB) OneUser(ctx context.Context, idone int, idtwo int) (*app.User, error)
- func (m *TestTooDB) OneUserLink(ctx context.Context, idone int, idtwo int) (*app.UserLink, error)
- func (m *TestTooDB) TableName() string
- func (m *TestTooDB) Update(ctx context.Context, model *TestToo) error
- func (m *TestTooDB) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, idone int, idtwo int) error
- func (m *TestTooDB) UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, idone int, idtwo int) error
- type TestTooStorage
- 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) List(ctx context.Context) []User
- func (m *UserDB) ListUser(ctx context.Context) []*app.User
- func (m *UserDB) ListUserLink(ctx context.Context) []*app.UserLink
- func (m *UserDB) OneUser(ctx context.Context, id int) (*app.User, error)
- func (m *UserDB) OneUserLink(ctx context.Context, id int) (*app.UserLink, error)
- func (m *UserDB) TableName() string
- func (m *UserDB) Update(ctx context.Context, model *User) error
- func (m *UserDB) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, 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 ProposalFilterByUser ¶
ProposalFilterByUser is a gorm filter for a Belongs To relationship.
func ReviewFilterByProposal ¶
ReviewFilterByProposal is a gorm filter for a Belongs To relationship.
Types ¶
type Proposal ¶
type Proposal struct { ID int `gorm:"primary_key"` // This is the Payload Model PK field Abstract string Detail string Reviews []Review // has many Reviews Title string UserID int // has many Proposal Withdrawn *bool CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp User User }
Proposal Model
func ProposalFromCreateProposalPayload ¶
func ProposalFromCreateProposalPayload(payload *app.CreateProposalPayload) *Proposal
ProposalFromCreateProposalPayload Converts source CreateProposalPayload to target Proposal model only copying the non-nil fields from the source.
func ProposalFromUpdateProposalPayload ¶
func ProposalFromUpdateProposalPayload(payload *app.UpdateProposalPayload) *Proposal
ProposalFromUpdateProposalPayload Converts source UpdateProposalPayload to target Proposal model only copying the non-nil fields from the source.
func (*Proposal) ProposalToProposal ¶
ProposalToProposal returns the Proposal representation of Proposal.
func (*Proposal) ProposalToProposalLink ¶
func (m *Proposal) ProposalToProposalLink() *app.ProposalLink
ProposalToProposalLink returns the Proposal representation of Proposal.
type ProposalDB ¶
ProposalDB is the implementation of the storage interface for Proposal.
func NewProposalDB ¶
func NewProposalDB(db gorm.DB) *ProposalDB
NewProposalDB creates a new storage type.
func (*ProposalDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*ProposalDB) Delete ¶
func (m *ProposalDB) Delete(ctx context.Context, id int) error
Delete removes a single record.
func (*ProposalDB) Get ¶
Get returns a single Proposal as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*ProposalDB) List ¶
func (m *ProposalDB) List(ctx context.Context) []Proposal
List returns an array of Proposal
func (*ProposalDB) ListProposal ¶
ListProposal returns an array of view: default.
func (*ProposalDB) ListProposalLink ¶
func (m *ProposalDB) ListProposalLink(ctx context.Context, userID int) []*app.ProposalLink
ListProposalLink returns an array of view: link.
func (*ProposalDB) OneProposal ¶
OneProposal returns an array of view: default.
func (*ProposalDB) OneProposalLink ¶
func (m *ProposalDB) OneProposalLink(ctx context.Context, id int, userID int) (*app.ProposalLink, error)
OneProposalLink returns an array of view: link.
func (*ProposalDB) TableName ¶
func (m *ProposalDB) TableName() string
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*ProposalDB) Update ¶
func (m *ProposalDB) Update(ctx context.Context, model *Proposal) error
Update modifies a single record.
func (*ProposalDB) UpdateFromCreateProposalPayload ¶
func (m *ProposalDB) UpdateFromCreateProposalPayload(ctx context.Context, payload *app.CreateProposalPayload, id int) error
UpdateFromCreateProposalPayload applies non-nil changes from CreateProposalPayload to the model and saves it
func (*ProposalDB) UpdateFromUpdateProposalPayload ¶
func (m *ProposalDB) UpdateFromUpdateProposalPayload(ctx context.Context, payload *app.UpdateProposalPayload, id int) error
UpdateFromUpdateProposalPayload applies non-nil changes from UpdateProposalPayload to the model and saves it
type ProposalStorage ¶
type ProposalStorage interface { DB() interface{} List(ctx context.Context) []Proposal Get(ctx context.Context, id int) (Proposal, error) Add(ctx context.Context, proposal *Proposal) (*Proposal, error) Update(ctx context.Context, proposal *Proposal) error Delete(ctx context.Context, id int) error ListProposal(ctx context.Context, userID int) []*app.Proposal OneProposal(ctx context.Context, id int, userID int) (*app.Proposal, error) ListProposalLink(ctx context.Context, userID int) []*app.ProposalLink OneProposalLink(ctx context.Context, id int, userID int) (*app.ProposalLink, error) UpdateFromCreateProposalPayload(ctx context.Context, payload *app.CreateProposalPayload, id int) error UpdateFromUpdateProposalPayload(ctx context.Context, payload *app.UpdateProposalPayload, id int) error }
ProposalStorage represents the storage interface.
type Review ¶
type Review struct { ID int `gorm:"primary_key"` // This is the Review Model PK field Comment *string ProposalID int // Belongs To Proposal Rating int UserID int // has many Review CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp Proposal Proposal User User }
Review Model
func ReviewFromCreateReviewPayload ¶
func ReviewFromCreateReviewPayload(payload *app.CreateReviewPayload) *Review
ReviewFromCreateReviewPayload Converts source CreateReviewPayload to target Review model only copying the non-nil fields from the source.
func ReviewFromUpdateReviewPayload ¶
func ReviewFromUpdateReviewPayload(payload *app.UpdateReviewPayload) *Review
ReviewFromUpdateReviewPayload Converts source UpdateReviewPayload to target Review model only copying the non-nil fields from the source.
func (*Review) ReviewToReview ¶
ReviewToReview returns the Review representation of Review.
func (*Review) ReviewToReviewLink ¶
func (m *Review) ReviewToReviewLink() *app.ReviewLink
ReviewToReviewLink returns the Review representation of Review.
type ReviewDB ¶
ReviewDB is the implementation of the storage interface for Review.
func (*ReviewDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*ReviewDB) Get ¶
Get returns a single Review as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*ReviewDB) ListReview ¶
ListReview returns an array of view: default.
func (*ReviewDB) ListReviewLink ¶
func (m *ReviewDB) ListReviewLink(ctx context.Context, proposalID int, userID int) []*app.ReviewLink
ListReviewLink returns an array of view: link.
func (*ReviewDB) OneReview ¶
func (m *ReviewDB) OneReview(ctx context.Context, id int, proposalID int, userID int) (*app.Review, error)
OneReview returns an array of view: default.
func (*ReviewDB) OneReviewLink ¶
func (m *ReviewDB) OneReviewLink(ctx context.Context, id int, proposalID int, userID int) (*app.ReviewLink, error)
OneReviewLink returns an array of view: link.
func (*ReviewDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*ReviewDB) UpdateFromCreateReviewPayload ¶
func (m *ReviewDB) UpdateFromCreateReviewPayload(ctx context.Context, payload *app.CreateReviewPayload, id int) error
UpdateFromCreateReviewPayload applies non-nil changes from CreateReviewPayload to the model and saves it
func (*ReviewDB) UpdateFromUpdateReviewPayload ¶
func (m *ReviewDB) UpdateFromUpdateReviewPayload(ctx context.Context, payload *app.UpdateReviewPayload, id int) error
UpdateFromUpdateReviewPayload applies non-nil changes from UpdateReviewPayload to the model and saves it
type ReviewStorage ¶
type ReviewStorage interface { DB() interface{} List(ctx context.Context) []Review Get(ctx context.Context, id int) (Review, error) Add(ctx context.Context, review *Review) (*Review, error) Update(ctx context.Context, review *Review) error Delete(ctx context.Context, id int) error ListReview(ctx context.Context, proposalID int, userID int) []*app.Review OneReview(ctx context.Context, id int, proposalID int, userID int) (*app.Review, error) ListReviewLink(ctx context.Context, proposalID int, userID int) []*app.ReviewLink OneReviewLink(ctx context.Context, id int, proposalID int, userID int) (*app.ReviewLink, error) UpdateFromCreateReviewPayload(ctx context.Context, payload *app.CreateReviewPayload, id int) error UpdateFromUpdateReviewPayload(ctx context.Context, payload *app.UpdateReviewPayload, id int) error }
ReviewStorage represents the storage interface.
type Test ¶
type Test struct { CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp }
Test Model
type TestDB ¶
TestDB is the implementation of the storage interface for Test.
func (*TestDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*TestDB) Get ¶
Get returns a single Test as a Database Model This is more for use internally, and probably not what you want in your controllers
type TestStorage ¶
type TestStorage interface { DB() interface{} List(ctx context.Context) []Test Get(ctx context.Context) (Test, error) Add(ctx context.Context, test *Test) (*Test, error) Update(ctx context.Context, test *Test) error Delete(ctx context.Context) error }
TestStorage represents the storage interface.
type TestToo ¶
type TestToo struct { Idone int `gorm:"primary_key"` // This is one of the TestToo Model PK fields Idtwo int `gorm:"primary_key"` // This is one of the TestToo Model PK fields Bio *string City *string Country *string Email string Firstname string Lastname string State *string CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp }
TestToo Model
func TestTooFromCreateUserPayload ¶
func TestTooFromCreateUserPayload(payload *app.CreateUserPayload) *TestToo
TestTooFromCreateUserPayload Converts source CreateUserPayload to target TestToo model only copying the non-nil fields from the source.
func TestTooFromUpdateUserPayload ¶
func TestTooFromUpdateUserPayload(payload *app.UpdateUserPayload) *TestToo
TestTooFromUpdateUserPayload Converts source UpdateUserPayload to target TestToo model only copying the non-nil fields from the source.
func (TestToo) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*TestToo) TestTooToUser ¶
TestTooToUser returns the User representation of TestToo.
func (*TestToo) TestTooToUserLink ¶
TestTooToUserLink returns the User representation of TestToo.
type TestTooDB ¶
TestTooDB is the implementation of the storage interface for TestToo.
func NewTestTooDB ¶
NewTestTooDB creates a new storage type.
func (*TestTooDB) Add ¶
Add creates a new record. /// Maybe shouldn't return the model, it's a pointer.
func (*TestTooDB) Get ¶
Get returns a single TestToo as a Database Model This is more for use internally, and probably not what you want in your controllers
func (*TestTooDB) ListUserLink ¶
ListUserLink returns an array of view: link.
func (*TestTooDB) OneUserLink ¶
OneUserLink returns an array of view: link.
func (*TestTooDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
func (*TestTooDB) UpdateFromCreateUserPayload ¶
func (m *TestTooDB) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, idone int, idtwo int) error
UpdateFromCreateUserPayload applies non-nil changes from CreateUserPayload to the model and saves it
func (*TestTooDB) UpdateFromUpdateUserPayload ¶
func (m *TestTooDB) UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, idone int, idtwo int) error
UpdateFromUpdateUserPayload applies non-nil changes from UpdateUserPayload to the model and saves it
type TestTooStorage ¶
type TestTooStorage interface { DB() interface{} List(ctx context.Context) []TestToo Get(ctx context.Context, idone int, idtwo int) (TestToo, error) Add(ctx context.Context, testtoo *TestToo) (*TestToo, error) Update(ctx context.Context, testtoo *TestToo) error Delete(ctx context.Context, idone int, idtwo int) error ListUser(ctx context.Context) []*app.User OneUser(ctx context.Context, idone int, idtwo int) (*app.User, error) ListUserLink(ctx context.Context) []*app.UserLink OneUserLink(ctx context.Context, idone int, idtwo int) (*app.UserLink, error) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, idone int, idtwo int) error UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, idone int, idtwo int) error }
TestTooStorage represents the storage interface.
type User ¶
type User struct { ID int `gorm:"primary_key"` // This is the User Model PK field Bio *string City *string Country *string Email string Firstname string Lastname string Proposals []Proposal // has many Proposals Reviews []Review // has many Reviews State *string CreatedAt time.Time // timestamp DeletedAt *time.Time // nullable timestamp (soft delete) UpdatedAt time.Time // timestamp }
User Model Description
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 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) 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.
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) OneUserLink ¶
OneUserLink returns an array of view: link.
func (*UserDB) TableName ¶
TableName overrides the table name settings in Gorm to force a specific table name in the database.
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) 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) []*app.User OneUser(ctx context.Context, id int) (*app.User, error) ListUserLink(ctx context.Context) []*app.UserLink OneUserLink(ctx context.Context, id int) (*app.UserLink, error) UpdateFromCreateUserPayload(ctx context.Context, payload *app.CreateUserPayload, id int) error UpdateFromUpdateUserPayload(ctx context.Context, payload *app.UpdateUserPayload, id int) error }
UserStorage represents the storage interface.