// Stockcollections retrieves all the stockcollection's stockcollection with an executor. func (o *Contact) Stockcollections(exec boil.Executor, mods ...qm.QueryMod) stockcollectionQuery { queryMods := []qm.QueryMod{ qm.Select("\"a\".*"), } if len(mods) != 0 { queryMods = append(queryMods, mods...) } queryMods = append(queryMods, qm.Where("\"a\".\"contact_id\"=$1", o.ContactID), ) query := Stockcollections(exec, queryMods...) queries.SetFrom(query.Query, "\"stockcollection\" as \"a\"") return query }
// Cvtermpaths retrieves all the cvtermpath's cvtermpath with an executor. func (o *CV) Cvtermpaths(exec boil.Executor, mods ...qm.QueryMod) cvtermpathQuery { queryMods := []qm.QueryMod{ qm.Select("\"a\".*"), } if len(mods) != 0 { queryMods = append(queryMods, mods...) } queryMods = append(queryMods, qm.Where("\"a\".\"cv_id\"=$1", o.CVID), ) query := Cvtermpaths(exec, queryMods...) queries.SetFrom(query.Query, "\"cvtermpath\" as \"a\"") return query }
// Thumbnails retrieves all the thumbnail's thumbnails with an executor. func (o *File) Thumbnails(exec boil.Executor, mods ...qm.QueryMod) thumbnailQuery { queryMods := []qm.QueryMod{ qm.Select("\"a\".*"), } if len(mods) != 0 { queryMods = append(queryMods, mods...) } queryMods = append(queryMods, qm.Where("\"a\".\"file_id\"=$1", o.ID), ) query := Thumbnails(exec, queryMods...) queries.SetFrom(query.Query, "\"thumbnails\" as \"a\"") return query }
// AuthUserRoles retrieves all the auth_user_role's auth user role with an executor. func (o *AuthRole) AuthUserRoles(exec boil.Executor, mods ...qm.QueryMod) authUserRoleQuery { queryMods := []qm.QueryMod{ qm.Select("\"a\".*"), } if len(mods) != 0 { queryMods = append(queryMods, mods...) } queryMods = append(queryMods, qm.Where("\"a\".\"auth_role_id\"=$1", o.AuthRoleID), ) query := AuthUserRoles(exec, queryMods...) queries.SetFrom(query.Query, "\"auth_user_role\" as \"a\"") return query }
// UserStockOrders retrieves all the stock_order's stock order with an executor via user_id column. func (o *AuthUser) UserStockOrders(exec boil.Executor, mods ...qm.QueryMod) stockOrderQuery { queryMods := []qm.QueryMod{ qm.Select("\"a\".*"), } if len(mods) != 0 { queryMods = append(queryMods, mods...) } queryMods = append(queryMods, qm.Where("\"a\".\"user_id\"=$1", o.AuthUserID), ) query := StockOrders(exec, queryMods...) queries.SetFrom(query.Query, "\"stock_order\" as \"a\"") return query }
// Create logs a user in func (s Controller) Create(e echo.Context) error { session := &userSession{} if err := e.Bind(session); err != nil { return err } user, err := models.Users(s.DB, qm.Select("hash"), qm.Where("username=$1", session.Username)).One() if err != nil { s.Error("failed to fetch user", "err", err) return e.NoContent(http.StatusInternalServerError) } if err := bcrypt.CompareHashAndPassword([]byte(user.Hash), []byte(session.Password)); err != nil { return e.JSONBlob(http.StatusUnauthorized, errInvalidCredentials) } return e.NoContent(http.StatusOK) }