entry

package
v0.0.0-...-e2fe045 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(db *database.DB, id int64) error

func GetCount

func GetCount(db *database.DB) (int, error)

func NewForm

func NewForm(raw FormRaw, problems []*models.Problem, laws []*models.Law, db *database.DB) (*Form, *FormError)

Types

type Age

type Age struct {
	Min uint64 `db:"age_min"`
	Max uint64 `db:"age_max"`
}

type Entry

type Entry struct {
	ID          int64
	Title       string
	Description string
	ProviderId  int64
	UserId      int64
	Url         sql.NullString
	SocialForm  string
	Contact     sql.NullString
	Locations   sql.NullString
	Draft       bool
	Ags         string
	Plzs        sql.NullString
	Age
	ProfOnly     bool
	Requirements sql.NullString
	Gender
	Created    time.Time
	LastUpdate time.Time
	Problems   []*models.Problem
	Laws       []*models.Law
}

func Add

func Add(db *database.DB, cfg *config.Config, data *Form, providerId int64, userId int64) (*Entry, error)

func CreateEntry

func CreateEntry(entry EntryRow, laws []*models.Law, problems []*models.Problem) *Entry

func GetById

func GetById(entryId int64, db *database.DB) (*Entry, error)

func GetByUser

func GetByUser(userId int64, db *database.DB) ([]*Entry, error)

func SearchEntries

func SearchEntries(data *models.SearchFilterData, professional bool, db *database.DB, r *http.Request, cfg *config.Config, distributor worker.TaskDistributor) ([]*Entry, *http.Cookie, error)

func Update

func Update(db *database.DB, cfg *config.Config, id int64, data *Form, providerId int64, userId int64) (*Entry, error)

func (*Entry) PrintGender

func (entry *Entry) PrintGender() string

func (*Entry) ToFormRaw

func (entry *Entry) ToFormRaw() *FormRaw

type EntryRow

type EntryRow struct {
	ID          int64          `db:"entry_id"`
	Title       string         `db:"title"`
	Description string         `db:"description"`
	ProviderId  int64          `db:"provider_id"`
	UserId      int64          `db:"user_id"`
	Url         sql.NullString `db:"url"`
	SocialForm  string         `db:"social_form"`
	Contact     sql.NullString `db:"contact"`
	Locations   sql.NullString `db:"locations"`
	Draft       bool           `db:"draft"`
	Ags         string         `db:"ags"`
	Plzs        sql.NullString `db:"plzs"`
	Age
	ProfOnly     bool           `db:"profonly"`
	Requirements sql.NullString `db:"requirements"`
	Gender
	Created    time.Time `db:"created"`
	LastUpdate time.Time `db:"last_update"`
}

type Form

type Form struct {
	Title        string
	Description  string
	Url          sql.NullString
	Locations    sql.NullString
	Contact      sql.NullString
	Ags          string
	Plzs         sql.NullString
	Problem      []*models.Problem
	AgeMin       uint64
	AgeMax       uint64
	Gender       map[string]bool
	Law          []*models.Law
	SocialForm   string
	Requirements sql.NullString
	ProfOnly     bool
	Draft        bool
}

type FormError

type FormError struct {
	Val map[string]string
	Raw *FormRaw
	Err error
}

func (*FormError) Error

func (e *FormError) Error() string

type FormRaw

type FormRaw struct {
	Id           string
	Title        string
	Description  string
	Url          string
	Locations    string
	Contact      string
	Ags          string
	Plzs         string
	Problem      []string
	AgeMin       string
	AgeMax       string
	Gender       map[string]string
	Law          []string
	SocialForm   string
	Requirements string
	ProfOnly     string
	Draft        string
}

type Gender

type Gender struct {
	Male   bool `db:"gender_male"`
	Female bool `db:"gender_female"`
	Queer  bool `db:"gender_queer"`
}

Jump to

Keyboard shortcuts

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