Documentation ¶
Index ¶
- Constants
- type CategoryRepository
- type NeedRepository
- func (r *NeedRepository) Create(n model.Need) (model.Need, error)
- func (r *NeedRepository) CreateImage(i model.NeedImage) (model.NeedImage, error)
- func (r *NeedRepository) DeleteImage(imageID, needID int64) error
- func (r *NeedRepository) Get(id int64) (*model.Need, error)
- func (r *NeedRepository) GetNeedsImages(n model.Need) ([]model.NeedImage, error)
- func (r *NeedRepository) GetOrganizationNeeds(oID int64, orderBy string, order string) ([]model.Need, error)
- func (r *NeedRepository) Update(n model.Need) (model.Need, error)
- type NeedResponseRepository
- type OrganizationRepository
- func (r *OrganizationRepository) ChangePassword(o model.Organization, currentPassword, newPassword string) (model.Organization, error)
- func (r *OrganizationRepository) Create(o model.Organization) (model.Organization, error)
- func (r *OrganizationRepository) CreateImage(i model.OrganizationImage) (model.OrganizationImage, error)
- func (r *OrganizationRepository) DeleteImage(imageID int64, organizationID int64) error
- func (r *OrganizationRepository) Get(id int64) (*model.Organization, error)
- func (r *OrganizationRepository) GetAll() ([]*model.Organization, error)
- func (r *OrganizationRepository) GetBaseOrganization(id int64) (*model.Organization, error)
- func (r *OrganizationRepository) GetByEmail(email string) (*model.Organization, error)
- func (r *OrganizationRepository) GetLogo(o model.Organization) (*model.OrganizationImage, error)
- func (r *OrganizationRepository) GetUserByEmail(email string) (model.User, error)
- func (r *OrganizationRepository) ResetPasswordTo(o *model.Organization, password string) error
- func (r *OrganizationRepository) Update(o model.Organization) (model.Organization, error)
- func (r *OrganizationRepository) UpdateLogo(imageID nulls.Int64, organizationID int64) error
- type SearchRepository
Constants ¶
const ResultsPerPage = 10
ResultsPerPage limits the result
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CategoryRepository ¶
type CategoryRepository struct {
// contains filtered or unexported fields
}
CategoryRepository to access database
func NewCategoryRepository ¶
func NewCategoryRepository(db *sqlx.DB) *CategoryRepository
NewCategoryRepository create a new repository
type NeedRepository ¶
type NeedRepository struct {
// contains filtered or unexported fields
}
NeedRepository is a implementation for Postgres
func NewNeedRepository ¶
func NewNeedRepository(db *sqlx.DB) *NeedRepository
NewNeedRepository creates a new repository
func (*NeedRepository) CreateImage ¶
CreateImage creates a new need image based on the struct
func (*NeedRepository) DeleteImage ¶
func (r *NeedRepository) DeleteImage(imageID, needID int64) error
DeleteImage delete a image from a need
func (*NeedRepository) Get ¶
func (r *NeedRepository) Get(id int64) (*model.Need, error)
Get one Need from database
func (*NeedRepository) GetNeedsImages ¶
GetNeedsImages retrive the images of a Need
func (*NeedRepository) GetOrganizationNeeds ¶
func (r *NeedRepository) GetOrganizationNeeds(oID int64, orderBy string, order string) ([]model.Need, error)
GetOrganizationNeeds return all needs from an organization
type NeedResponseRepository ¶
type NeedResponseRepository struct {
// contains filtered or unexported fields
}
NeedResponseRepository is a implementation for Postgres
func NewNeedResponseRepository ¶
func NewNeedResponseRepository(db *sqlx.DB) *NeedResponseRepository
NewNeedResponseRepository creates a new repository
func (*NeedResponseRepository) CreateResponse ¶
func (r *NeedResponseRepository) CreateResponse(nr *model.NeedResponse) (int64, error)
CreateResponse create NeedResponse in database
type OrganizationRepository ¶
type OrganizationRepository struct {
// contains filtered or unexported fields
}
OrganizationRepository is a implementation for Postgres
func NewOrganizationRepository ¶
func NewOrganizationRepository(db *sqlx.DB) *OrganizationRepository
NewOrganizationRepository creates a new repository
func (*OrganizationRepository) ChangePassword ¶
func (r *OrganizationRepository) ChangePassword(o model.Organization, currentPassword, newPassword string) (model.Organization, error)
ChangePassword will update a organization password given its old password
func (*OrganizationRepository) Create ¶
func (r *OrganizationRepository) Create(o model.Organization) (model.Organization, error)
Create receives a Organization and creates it in the database, returning the updated Organization or error if failed
func (*OrganizationRepository) CreateImage ¶
func (r *OrganizationRepository) CreateImage(i model.OrganizationImage) (model.OrganizationImage, error)
CreateImage creates a new organization image based on the struct
func (*OrganizationRepository) DeleteImage ¶
func (r *OrganizationRepository) DeleteImage(imageID int64, organizationID int64) error
DeleteImage - Receive an id and remove the image
func (*OrganizationRepository) Get ¶
func (r *OrganizationRepository) Get(id int64) (*model.Organization, error)
Get one Organization from database
func (*OrganizationRepository) GetAll ¶
func (r *OrganizationRepository) GetAll() ([]*model.Organization, error)
GetAll Organizations from database
func (*OrganizationRepository) GetBaseOrganization ¶
func (r *OrganizationRepository) GetBaseOrganization(id int64) (*model.Organization, error)
GetBaseOrganization returns only the data about a organization, not its relations
func (*OrganizationRepository) GetByEmail ¶
func (r *OrganizationRepository) GetByEmail(email string) (*model.Organization, error)
GetByEmail returns a organization by its email
func (*OrganizationRepository) GetLogo ¶
func (r *OrganizationRepository) GetLogo(o model.Organization) (*model.OrganizationImage, error)
GetLogo returns organization logo image
func (*OrganizationRepository) GetUserByEmail ¶
func (r *OrganizationRepository) GetUserByEmail(email string) (model.User, error)
GetUserByEmail returns a organization user by its email
func (*OrganizationRepository) ResetPasswordTo ¶
func (r *OrganizationRepository) ResetPasswordTo(o *model.Organization, password string) error
ResetPasswordTo resets the organization password to the value informed
func (*OrganizationRepository) Update ¶
func (r *OrganizationRepository) Update(o model.Organization) (model.Organization, error)
Update - Receive an Organization and update it in the database, returning the updated Organization or error if failed
func (*OrganizationRepository) UpdateLogo ¶
func (r *OrganizationRepository) UpdateLogo(imageID nulls.Int64, organizationID int64) error
UpdateLogo will change the logo image
type SearchRepository ¶
type SearchRepository struct {
// contains filtered or unexported fields
}
SearchRepository is an implementation for Postgres
func NewSearchRepository ¶
func NewSearchRepository(db *sqlx.DB) *SearchRepository
NewSearchRepository creates a new repository