Documentation
¶
Index ¶
- Constants
- type DAO
- func (d *DAO) CountImages(ctx context.Context, filterInput ListImageFilter) (int64, error)
- func (d *DAO) CreateAnimal(ctx context.Context, in model.Animal) (*model.Animal, error)
- func (d *DAO) CreateArticle(ctx context.Context, in model.Article) (*model.Article, error)
- func (d *DAO) CreateImage(ctx context.Context, in model.Image) (*model.Image, error)
- func (d *DAO) CreatePage(ctx context.Context, in model.Page) (*model.Page, error)
- func (d *DAO) CreatePasswordToken(ctx context.Context, token model.PasswordRenewalToken) (*model.PasswordRenewalToken, error)
- func (d *DAO) DeleteImage(ctx context.Context, id primitive.ObjectID) error
- func (d *DAO) DeletePage(ctx context.Context, id primitive.ObjectID) error
- func (d *DAO) DeletePasswordToken(ctx context.Context, id primitive.ObjectID) error
- func (d *DAO) GetAnimalByID(ctx context.Context, id primitive.ObjectID) (*model.Animal, error)
- func (d *DAO) GetArticleByID(ctx context.Context, id primitive.ObjectID) (*model.Article, error)
- func (d *DAO) GetImageByID(ctx context.Context, id primitive.ObjectID) (*model.Image, error)
- func (d *DAO) GetPageByID(ctx context.Context, id primitive.ObjectID) (*model.Page, error)
- func (d *DAO) GetPasswordTokenByValue(ctx context.Context, token string) (*model.PasswordRenewalToken, error)
- func (d *DAO) GetUserByEmail(ctx context.Context, email string) (*model.User, error)
- func (d *DAO) GetUserByID(ctx context.Context, id primitive.ObjectID) (*model.User, error)
- func (d *DAO) GetUserByName(ctx context.Context, username string) (*model.User, error)
- func (d *DAO) ListAnimals(ctx context.Context, filter ListAnimalsFilter, pagination paging.StdPaging) ([]model.Animal, error)
- func (d *DAO) ListArticles(ctx context.Context, filter ListArticlesFilter, pagination paging.StdPaging) ([]model.Article, error)
- func (d *DAO) ListImages(ctx context.Context, f ListImageFilter, pagination paging.StdPaging) ([]model.Image, error)
- func (d *DAO) ListPages(ctx context.Context, filter ListPagesFilter, pagination paging.StdPaging) ([]model.Page, error)
- func (d *DAO) UpdateAnimal(ctx context.Context, id primitive.ObjectID, in model.Animal) (*model.Animal, error)
- func (d *DAO) UpdateArticle(ctx context.Context, id primitive.ObjectID, in model.Article) (*model.Article, error)
- func (d *DAO) UpdatePage(ctx context.Context, id primitive.ObjectID, in model.Page) (*model.Page, error)
- func (d *DAO) UpdateUser(ctx context.Context, id primitive.ObjectID, in model.User) (*model.User, error)
- type ListAnimalsFilter
- type ListArticlesFilter
- type ListImageFilter
- type ListPagesFilter
Constants ¶
const AnimalCollection = "animals"
AnimalCollection collection name
const ArticleCollection = "articles"
ArticleCollection collection name
const ImageCollection = "images"
ImageCollection collection name
const PageCollection = "pages"
PageCollection collection name
const PasswordTokenAuthCollection = "usersPasswordTokenAuth"
PasswordTokenAuthCollection is the collection used for user password storage
const UserCollection = "users"
UserCollection collection name
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DAO ¶
type DAO struct {
// contains filtered or unexported fields
}
DAO allow easy acces to database
func (*DAO) CountImages ¶
CountImages count images with provided filters
func (*DAO) CreateAnimal ¶
CreateAnimal create a new animal
func (*DAO) CreateArticle ¶
CreateArticle add a article to DB
func (*DAO) CreateImage ¶
CreateImage add a image to DB
func (*DAO) CreatePage ¶
CreatePage add a page to DB
func (*DAO) CreatePasswordToken ¶
func (d *DAO) CreatePasswordToken(ctx context.Context, token model.PasswordRenewalToken) (*model.PasswordRenewalToken, error)
CreatePasswordToken create a new password renewal token
func (*DAO) DeleteImage ¶
DeleteImage delete an image to DB
func (*DAO) DeletePage ¶
DeletePage delete a page to DB
func (*DAO) DeletePasswordToken ¶
DeletePasswordToken delete a password renewal token
func (*DAO) GetAnimalByID ¶
GetAnimalByID get animal by id
func (*DAO) GetArticleByID ¶
GetArticleByID get article by id
func (*DAO) GetImageByID ¶
GetImageByID get image by id
func (*DAO) GetPageByID ¶
GetPageByID get page by id
func (*DAO) GetPasswordTokenByValue ¶
func (d *DAO) GetPasswordTokenByValue(ctx context.Context, token string) (*model.PasswordRenewalToken, error)
GetPasswordTokenByValue get a password renewal token by its value
func (*DAO) GetUserByEmail ¶
GetUserByEmail get user by email
func (*DAO) GetUserByID ¶
GetUserByID get user by id
func (*DAO) GetUserByName ¶
GetUserByName get user by name
func (*DAO) ListAnimals ¶
func (d *DAO) ListAnimals(ctx context.Context, filter ListAnimalsFilter, pagination paging.StdPaging) ([]model.Animal, error)
ListAnimals list animals
func (*DAO) ListArticles ¶
func (d *DAO) ListArticles(ctx context.Context, filter ListArticlesFilter, pagination paging.StdPaging) ([]model.Article, error)
ListArticles list articles
func (*DAO) ListImages ¶
func (d *DAO) ListImages(ctx context.Context, f ListImageFilter, pagination paging.StdPaging) ([]model.Image, error)
ListImages list images
func (*DAO) ListPages ¶
func (d *DAO) ListPages(ctx context.Context, filter ListPagesFilter, pagination paging.StdPaging) ([]model.Page, error)
ListPages list pages
func (*DAO) UpdateAnimal ¶
func (d *DAO) UpdateAnimal(ctx context.Context, id primitive.ObjectID, in model.Animal) (*model.Animal, error)
UpdateAnimal update an animal to DB
func (*DAO) UpdateArticle ¶
func (d *DAO) UpdateArticle(ctx context.Context, id primitive.ObjectID, in model.Article) (*model.Article, error)
UpdateArticle update an article to DB
type ListAnimalsFilter ¶
type ListAnimalsFilter struct { Name *string `mgo-filter:"name,op:$eq,omitempty"` Description *string `mgo-filter:"description,op:$eq,omitempty"` Birthdate *time.Time `mgo-filter:"birthdate,op:$eq,omitempty"` Sex *model.Sex `mgo-filter:"sex,op:$eq,omitempty"` Color *string `mgo-filter:"color,op:$eq,omitempty"` AdoptionStatus *model.AdoptionStatus `mgo-filter:"adoptionstatus,op:$eq,omitempty"` RawFilter bson.M `mgo-filter-raw:"-"` }
ListAnimalsFilter contains filtering tools
type ListArticlesFilter ¶
type ListArticlesFilter struct { Name *string `mgo-filter:"name,op:$eq,omitempty"` RawFilter bson.M `mgo-filter-raw:"-"` }
ListArticlesFilter contains filtering tools
type ListImageFilter ¶
type ListImageFilter struct { Name *string `mgo-filter:"name,op:$eq,omitempty"` ID *primitive.ObjectID `mgo-filter:"_id,op:$eq,omitempty"` RawFilter bson.M `mgo-filter-raw:"-"` }
ListImageFilter contains filtering tools
type ListPagesFilter ¶
type ListPagesFilter struct {
Name *string `mgo-filter:"name,op:$eq,omitempty"`
}
ListPagesFilter contains filtering tools