repo

package
v0.0.0-...-a35bd06 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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

func (*CategoryRepository) Get

Get a category from database using its id

func (*CategoryRepository) GetAll

func (r *CategoryRepository) GetAll() ([]model.Category, error)

GetAll return all categories

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) Create

func (r *NeedRepository) Create(n model.Need) (model.Need, error)

Create creates a new need based on the struct

func (*NeedRepository) CreateImage

func (r *NeedRepository) CreateImage(i model.NeedImage) (model.NeedImage, error)

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

func (r *NeedRepository) GetNeedsImages(n model.Need) ([]model.NeedImage, error)

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

func (*NeedRepository) Update

func (r *NeedRepository) Update(n model.Need) (model.Need, error)

Update - Receive a Need and update it in the database, returning the updated Need or error if failed

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

Create receives a Organization and creates it in the database, returning the updated Organization or error if failed

func (*OrganizationRepository) CreateImage

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

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

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

Update - Receive an Organization and update it in the database, returning the updated Organization or error if failed

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

func (*SearchRepository) Search

func (r *SearchRepository) Search(text string, categoriesID []int, organizationsID int64, status string, orderBy string, order string, page int) (needs []model.SearchNeed, count int, err error)

Search needs by text, category or organization

Jump to

Keyboard shortcuts

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