model

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer string
const (
	AnswerA Answer = "a"
	AnswerB Answer = "b"
	AnswerC Answer = "c"
	AnswerD Answer = "d"
)

func (Answer) IsValid

func (answer Answer) IsValid() bool

func (Answer) MarshalGQL

func (answer Answer) MarshalGQL(w io.Writer)

func (Answer) String

func (answer Answer) String() string

func (*Answer) UnmarshalGQL

func (answer *Answer) UnmarshalGQL(v interface{}) error

type Profession

type Profession struct {
	ID          int       `json:"id,omitempty" xml:"id" gqlgen:"id"`
	Slug        string    `json:"slug" pg:",unique" xml:"slug" gqlgen:"slug"`
	Name        string    `json:"name,omitempty" pg:",unique" xml:"name" gqlgen:"name"`
	Description string    `json:"description,omitempty" xml:"description" gqlgen:"description"`
	CreatedAt   time.Time `json:"createdAt,omitempty" pg:"default:now()" xml:"createdAt" gqlgen:"createdAt"`
	// contains filtered or unexported fields
}

func (*Profession) BeforeInsert

func (p *Profession) BeforeInsert(ctx context.Context) (context.Context, error)

func (*Profession) BeforeUpdate

func (p *Profession) BeforeUpdate(ctx context.Context) (context.Context, error)

type ProfessionFilter

type ProfessionFilter struct {
	ID    []int `gqlgen:"id" json:"id" xml:"id"`
	IDNEQ []int `gqlgen:"idNEQ" json:"idNEQ" xml:"idNEQ"`

	Slug    []string `json:"slug" xml:"slug" gqlgen:"slug"`
	SlugNEQ []string `json:"slugNEQ" xml:"slugNEQ" gqlgen:"slugNEQ"`

	Name      []string `gqlgen:"name" json:"name" xml:"name"`
	NameNEQ   []string `json:"nameNEQ" xml:"nameNEQ" gqlgen:"nameNEQ"`
	NameMATCH string   `json:"nameMATCH" xml:"nameMATCH" gqlgen:"nameMATCH"`
	NameIEQ   string   `gqlgen:"nameIEQ" json:"nameIEQ" xml:"nameIEQ"`

	DescriptionMATCH string `gqlgen:"descriptionMATCH" json:"descriptionMATCH" xml:"descriptionMATCH"`
	DescriptionIEQ   string `json:"descriptionIEQ" xml:"descriptionIEQ" gqlgen:"descriptionIEQ"`

	QualificationID []int `gqlgen:"qualificationID" xml:"qualificationID" json:"qualificationID"`

	CreatedAt    time.Time `gqlgen:"createdAt" json:"createdAt" xml:"createdAt"`
	CreatedAtGT  time.Time `gqlgen:"createdAtGT" json:"createdAtGT" xml:"createdAtGT"`
	CreatedAtGTE time.Time `json:"createdAtGTE" xml:"createdAtGTE" gqlgen:"createdAtGTE"`
	CreatedAtLT  time.Time `gqlgen:"createdAtLT" json:"createdAtLT" xml:"createdAtLT"`
	CreatedAtLTE time.Time `json:"createdAtLTE" xml:"createdAtLTE" gqlgen:"createdAtLTE"`
}

func (*ProfessionFilter) Where

func (f *ProfessionFilter) Where(q *orm.Query) (*orm.Query, error)

func (*ProfessionFilter) WhereWithAlias

func (f *ProfessionFilter) WhereWithAlias(q *orm.Query, alias string) (*orm.Query, error)

type ProfessionInput

type ProfessionInput struct {
	Name        *string `json:"name,omitempty" xml:"name" gqlgen:"name"`
	Description *string `json:"description,omitempty" xml:"description" gqlgen:"description"`
}

func (*ProfessionInput) ApplyUpdate

func (input *ProfessionInput) ApplyUpdate(q *orm.Query) (*orm.Query, error)

func (*ProfessionInput) IsEmpty

func (input *ProfessionInput) IsEmpty() bool

func (*ProfessionInput) Sanitize

func (input *ProfessionInput) Sanitize() *ProfessionInput

func (*ProfessionInput) ToProfession

func (input *ProfessionInput) ToProfession() *Profession

type Qualification

type Qualification struct {
	ID          int       `json:"id" xml:"id" gqlgen:"id"`
	Slug        string    `json:"slug" pg:",unique" xml:"slug" gqlgen:"slug"`
	Name        string    `json:"name" pg:",unique:group_1" xml:"name" gqlgen:"name"`
	Code        string    `json:"code" pg:",unique:group_1" xml:"code" gqlgen:"code"`
	Formula     string    `json:"formula" xml:"formula" gqlgen:"formula"`
	Description string    `json:"description" xml:"description" gqlgen:"description"`
	CreatedAt   time.Time `json:"createdAt,omitempty" pg:"default:now()" xml:"createdAt" gqlgen:"createdAt"`
	// contains filtered or unexported fields
}

func (*Qualification) BeforeInsert

func (q *Qualification) BeforeInsert(ctx context.Context) (context.Context, error)

func (*Qualification) BeforeUpdate

func (q *Qualification) BeforeUpdate(ctx context.Context) (context.Context, error)

type QualificationFilter

type QualificationFilter struct {
	ID    []int `gqlgen:"id" json:"id" xml:"id"`
	IDNEQ []int `gqlgen:"idNEQ" json:"idNEQ" xml:"idNEQ"`

	Slug    []string `json:"slug" xml:"slug" gqlgen:"slug"`
	SlugNEQ []string `json:"slugNEQ" xml:"slugNEQ" gqlgen:"slugNEQ"`

	Formula    []string `gqlgen:"formula" json:"formula" xml:"formula"`
	FormulaNEQ []string `json:"formulaNEQ" xml:"formulaNEQ" gqlgen:"formulaNEQ"`

	Name      []string `gqlgen:"name" json:"name" xml:"name"`
	NameNEQ   []string `json:"nameNEQ" xml:"nameNEQ" gqlgen:"nameNEQ"`
	NameMATCH string   `json:"nameMATCH" xml:"nameMATCH" gqlgen:"nameMATCH"`
	NameIEQ   string   `gqlgen:"nameIEQ" json:"nameIEQ" xml:"nameIEQ"`

	Code      []string `gqlgen:"code" json:"code" xml:"code"`
	CodeNEQ   []string `json:"codeNEQ" xml:"codeNEQ" gqlgen:"codeNEQ"`
	CodeMATCH string   `json:"codeMATCH" xml:"codeMATCH" gqlgen:"codeMATCH"`
	CodeIEQ   string   `gqlgen:"codeIEQ" json:"codeIEQ" xml:"codeIEQ"`

	DescriptionMATCH string `gqlgen:"descriptionMATCH" json:"descriptionMATCH" xml:"descriptionMATCH"`
	DescriptionIEQ   string `json:"descriptionIEQ" xml:"descriptionIEQ" gqlgen:"descriptionIEQ"`

	ProfessionID []int `json:"professionID" xml:"professionID" gqlgen:"professionID"`

	CreatedAt    time.Time `gqlgen:"createdAt" json:"createdAt" xml:"createdAt"`
	CreatedAtGT  time.Time `gqlgen:"createdAtGT" json:"createdAtGT" xml:"createdAtGT"`
	CreatedAtGTE time.Time `json:"createdAtGTE" xml:"createdAtGTE" gqlgen:"createdAtGTE"`
	CreatedAtLT  time.Time `gqlgen:"createdAtLT" json:"createdAtLT" xml:"createdAtLT"`
	CreatedAtLTE time.Time `json:"createdAtLTE" xml:"createdAtLTE" gqlgen:"createdAtLTE"`

	Or *QualificationFilterOr `json:"or" xml:"or" gqlgen:"or"`
}

func (*QualificationFilter) Where

func (f *QualificationFilter) Where(q *orm.Query) (*orm.Query, error)

func (*QualificationFilter) WhereWithAlias

func (f *QualificationFilter) WhereWithAlias(q *orm.Query, alias string) (*orm.Query, error)

type QualificationFilterOr

type QualificationFilterOr struct {
	NameMATCH string `json:"nameMATCH" xml:"nameMATCH" gqlgen:"nameMATCH"`
	NameIEQ   string `gqlgen:"nameIEQ" json:"nameIEQ" xml:"nameIEQ"`

	CodeMATCH string `json:"codeMATCH" xml:"codeMATCH" gqlgen:"codeMATCH"`
	CodeIEQ   string `gqlgen:"codeIEQ" json:"codeIEQ" xml:"codeIEQ"`
}

func (*QualificationFilterOr) WhereWithAlias

func (f *QualificationFilterOr) WhereWithAlias(q *orm.Query, alias string) *orm.Query

type QualificationInput

type QualificationInput struct {
	Name                 *string `json:"name" xml:"name" gqlgen:"name"`
	Description          *string `json:"description" xml:"description" gqlgen:"description"`
	Code                 *string `json:"code" xml:"code" gqlgen:"code"`
	Formula              *string `json:"formula" xml:"formula" gqlgen:"formula"`
	AssociateProfession  []int   `json:"associateProfession" xml:"associateProfession" gqlgen:"associateProfession"`
	DissociateProfession []int   `json:"dissociateProfession" xml:"dissociateProfession" gqlgen:"dissociateProfession"`
}

func (*QualificationInput) ApplyUpdate

func (input *QualificationInput) ApplyUpdate(q *orm.Query) (*orm.Query, error)

func (*QualificationInput) HasBasicDataToUpdate

func (input *QualificationInput) HasBasicDataToUpdate() bool

func (*QualificationInput) IsEmpty

func (input *QualificationInput) IsEmpty() bool

func (*QualificationInput) Sanitize

func (input *QualificationInput) Sanitize() *QualificationInput

func (*QualificationInput) ToQualification

func (input *QualificationInput) ToQualification() *Qualification

type QualificationToProfession

type QualificationToProfession struct {
	ID              int            `json:"id" xml:"id" gqlgen:"id"`
	QualificationID int            `pg:"on_delete:CASCADE,unique:group_1" json:"qualificationID" xml:"qualificationID" gqlgen:"qualificationID"`
	Qualification   *Qualification `pg:"rel:has-one" json:"qualification" xml:"qualification" gqlgen:"qualification"`
	ProfessionID    int            `pg:"on_delete:CASCADE,unique:group_1" json:"professionID" xml:"professionID" gqlgen:"professionID"`
	Profession      *Profession    `pg:"rel:has-one" json:"profession" xml:"profession" gqlgen:"profession"`
}

type Question

type Question struct {
	ID              int            `json:"id" xml:"id" gqlgen:"id"`
	From            string         `pg:",unique:group_1" json:"from" xml:"from" gqlgen:"from"`
	Content         string         `pg:",unique:group_1,notnull" json:"content" xml:"content" gqlgen:"content"`
	Explanation     string         `json:"explanation" xml:"explanation" gqlgen:"explanation"`
	CorrectAnswer   Answer         `pg:",unique:group_1,notnull" json:"correctAnswer" xml:"correctAnswer" gqlgen:"correctAnswer"`
	Image           string         `json:"image" xml:"image" gqlgen:"image"`
	AnswerA         string         `pg:"answer_a" json:"answerA" xml:"answerA" gqlgen:"answerA"`
	AnswerAImage    string         `pg:"answer_a_image" json:"answerAImage" xml:"answerAImage" gqlgen:"answerAImage"`
	AnswerB         string         `pg:"answer_b" json:"answerB" xml:"answerB" gqlgen:"answerB"`
	AnswerBImage    string         `pg:"answer_b_image" json:"answerBImage" xml:"answerBImage" gqlgen:"answerBImage"`
	AnswerC         string         `pg:"answer_c" json:"answerC" xml:"answerC" gqlgen:"answerC"`
	AnswerCImage    string         `pg:"answer_c_image" json:"answerCImage" xml:"answerCImage" gqlgen:"answerCImage"`
	AnswerD         string         `pg:"answer_d" json:"answerD" xml:"answerD" gqlgen:"answerD"`
	AnswerDImage    string         `pg:"answer_d_image" json:"answerDImage" xml:"answerDImage" gqlgen:"answerDImage"`
	QualificationID int            `pg:",unique:group_1,on_delete:CASCADE" json:"qualificationID" xml:"qualificationID" gqlgen:"qualificationID"`
	Qualification   *Qualification `pg:"rel:has-one" json:"qualification" xml:"qualification" gqlgen:"qualification"`
	CreatedAt       time.Time      `json:"createdAt,omitempty" pg:"default:now()" xml:"createdAt" gqlgen:"createdAt"`
	UpdatedAt       time.Time      `pg:"default:now()" json:"updatedAt" xml:"updatedAt" gqlgen:"updatedAt"`
	// contains filtered or unexported fields
}

func (*Question) BeforeInsert

func (q *Question) BeforeInsert(ctx context.Context) (context.Context, error)

type QuestionFilter

type QuestionFilter struct {
	ID    []int `gqlgen:"id" json:"id" xml:"id"`
	IDNEQ []int `gqlgen:"idNEQ" json:"idNEQ" xml:"idNEQ"`

	From []string `json:"from" xml:"from" gqlgen:"from"`

	ContentMATCH string `json:"contentMATCH" xml:"contentMATCH" gqlgen:"contentMATCH"`
	ContentIEQ   string `json:"contentIEQ" xml:"contentIEQ" gqlgen:"contentIEQ"`

	QualificationID     []int                `json:"qualificationID" xml:"qualificationID" gqlgen:"qualificationID"`
	QualificationIDNEQ  []int                `json:"qualificationIDNEQ" xml:"qualificationIDNEQ" gqlgen:"qualificationIDNEQ"`
	QualificationFilter *QualificationFilter `json:"qualificationFilter" xml:"qualificationFilter" gqlgen:"qualificationFilter"`

	CreatedAt    time.Time `gqlgen:"createdAt" json:"createdAt" xml:"createdAt"`
	CreatedAtGT  time.Time `gqlgen:"createdAtGT" json:"createdAtGT" xml:"createdAtGT"`
	CreatedAtGTE time.Time `json:"createdAtGTE" xml:"createdAtGTE" gqlgen:"createdAtGTE"`
	CreatedAtLT  time.Time `gqlgen:"createdAtLT" json:"createdAtLT" xml:"createdAtLT"`
	CreatedAtLTE time.Time `json:"createdAtLTE" xml:"createdAtLTE" gqlgen:"createdAtLTE"`
}

func (*QuestionFilter) Where

func (f *QuestionFilter) Where(q *orm.Query) (*orm.Query, error)

func (*QuestionFilter) WhereWithAlias

func (f *QuestionFilter) WhereWithAlias(q *orm.Query, alias string) (*orm.Query, error)

type QuestionInput

type QuestionInput struct {
	Content            *string         `json:"content" xml:"content" gqlgen:"content"`
	From               *string         `json:"from" xml:"from" gqlgen:"from"`
	Explanation        *string         `json:"explanation" xml:"explanation" gqlgen:"explanation"`
	CorrectAnswer      *Answer         `json:"correctAnswer" xml:"correctAnswer" gqlgen:"correctAnswer"`
	AnswerA            *string         `gqlgen:"answerA" json:"answerA" xml:"answerA"`
	AnswerB            *string         `gqlgen:"answerB" json:"answerB" xml:"answerB"`
	AnswerC            *string         `gqlgen:"answerC" json:"answerC" xml:"answerC"`
	AnswerD            *string         `gqlgen:"answerD" json:"answerD" xml:"answerD"`
	QualificationID    *int            `gqlgen:"qualificationID" json:"qualificationID" xml:"qualificationID"`
	Image              *graphql.Upload `json:"image" xml:"image" gqlgen:"image"`
	DeleteImage        *bool           `json:"deleteImage" xml:"deleteImage" gqlgen:"deleteImage"`
	AnswerAImage       *graphql.Upload `json:"answerAImage" gqlgen:"answerAImage" xml:"answerAImage"`
	DeleteAnswerAImage *bool           `json:"deleteAnswerAImage" xml:"deleteAnswerAImage" gqlgen:"deleteAnswerAImage"`
	AnswerBImage       *graphql.Upload `json:"answerBImage" gqlgen:"answerBImage" xml:"answerBImage"`
	DeleteAnswerBImage *bool           `json:"deleteAnswerBImage" xml:"deleteAnswerBImage" gqlgen:"deleteAnswerBImage"`
	AnswerCImage       *graphql.Upload `json:"answerCImage" gqlgen:"answerCImage" xml:"answerCImage"`
	DeleteAnswerCImage *bool           `json:"deleteAnswerCImage" xml:"deleteAnswerCImage" gqlgen:"deleteAnswerCImage"`
	AnswerDImage       *graphql.Upload `json:"answerDImage" gqlgen:"answerDImage" xml:"answerDImage"`
	DeleteAnswerDImage *bool           `json:"deleteAnswerDImage" xml:"deleteAnswerDImage" gqlgen:"deleteAnswerDImage"`
}

func (*QuestionInput) ApplyUpdate

func (input *QuestionInput) ApplyUpdate(q *orm.Query) (*orm.Query, error)

func (*QuestionInput) HasBasicDataToUpdate

func (input *QuestionInput) HasBasicDataToUpdate() bool

func (*QuestionInput) IsEmpty

func (input *QuestionInput) IsEmpty() bool

func (*QuestionInput) Sanitize

func (input *QuestionInput) Sanitize() *QuestionInput

func (*QuestionInput) ToQuestion

func (input *QuestionInput) ToQuestion() *Question

type Role

type Role string
const (
	RoleAdmin Role = "admin"
	RoleUser  Role = "user"
)

func (Role) IsValid

func (role Role) IsValid() bool

func (Role) MarshalGQL

func (role Role) MarshalGQL(w io.Writer)

func (Role) String

func (role Role) String() string

func (*Role) UnmarshalGQL

func (role *Role) UnmarshalGQL(v interface{}) error

type User

type User struct {
	ID          int       `json:"id" pg:",pk" xml:"id" gqlgen:"id"`
	DisplayName string    `json:"displayName" pg:",use_zero,notnull" xml:"displayName" gqlgen:"displayName"`
	Password    string    `json:"-" gqlgen:"-" xml:"password"`
	Email       string    `json:"email" pg:",unique" xml:"email" gqlgen:"email"`
	CreatedAt   time.Time `json:"createdAt" pg:"default:now()" xml:"createdAt" gqlgen:"createdAt"`
	Role        Role      `json:"role" xml:"role" gqlgen:"role"`
	Activated   *bool     `json:"activated" pg:"default:false,use_zero" xml:"activated" gqlgen:"activated"`
	// contains filtered or unexported fields
}

func (*User) BeforeInsert

func (u *User) BeforeInsert(ctx context.Context) (context.Context, error)

func (*User) CompareHashAndPassword

func (u *User) CompareHashAndPassword(password string) error

type UserFilter

type UserFilter struct {
	ID    []int `json:"id" xml:"id" gqlgen:"id"`
	IDNEQ []int `json:"idNEQ" xml:"idNEQ" gqlgen:"idNEQ"`

	Activated *bool `json:"activated" xml:"activated" gqlgen:"activated"`

	DisplayName      []string `json:"displayName" xml:"displayName" gqlgen:"displayName"`
	DisplayNameNEQ   []string `json:"displayNameNEQ" xml:"displayNameNEQ" gqlgen:"displayNameNEQ"`
	DisplayNameIEQ   string   `json:"displayNameIEQ" xml:"displayNameIEQ" gqlgen:"displayNameIEQ"`
	DisplayNameMATCH string   `json:"displayNameMATCH" xml:"displayNameMATCH" gqlgen:"displayNameMATCH"`

	Email      []string `json:"email" xml:"email" gqlgen:"email"`
	EmailNEQ   []string `json:"emailNEQ" xml:"emailNEQ" gqlgen:"emailNEQ"`
	EmailIEQ   string   `json:"emailIEQ" xml:"emailIEQ" gqlgen:"emailIEQ"`
	EmailMATCH string   `json:"emailMATCH" xml:"emailMATCH" gqlgen:"emailMATCH"`

	Role    []Role `json:"role" xml:"role" gqlgen:"role"`
	RoleNEQ []Role `json:"roleNEQ" xml:"roleNEQ" gqlgen:"roleNEQ"`

	CreatedAt    time.Time `json:"createdAt" xml:"createdAt" gqlgen:"createdAt"`
	CreatedAtGT  time.Time `json:"createdAtGT" xml:"createdAtGT" gqlgen:"createdAtGT"`
	CreatedAtGTE time.Time `json:"createdAtGTE" xml:"createdAtGTE" gqlgen:"createdAtGTE"`
	CreatedAtLT  time.Time `json:"createdAtLT" xml:"createdAtLT" gqlgen:"createdAtLT"`
	CreatedAtLTE time.Time `json:"createdAtLTE" xml:"createdAtLTE" gqlgen:"createdAtLTE"`

	Or *UserFilterOr
}

func (*UserFilter) Where

func (f *UserFilter) Where(q *orm.Query) (*orm.Query, error)

func (*UserFilter) WhereWithAlias

func (f *UserFilter) WhereWithAlias(q *orm.Query, alias string) (*orm.Query, error)

type UserFilterOr

type UserFilterOr struct {
	DisplayNameIEQ   string `json:"displayNameIEQ" xml:"displayNameIEQ" gqlgen:"displayNameIEQ"`
	DisplayNameMATCH string `json:"displayNameMATCH" xml:"displayNameMATCH" gqlgen:"displayNameMATCH"`

	EmailIEQ   string `json:"emailIEQ" xml:"emailIEQ" gqlgen:"emailIEQ"`
	EmailMATCH string `json:"emailMATCH" xml:"emailMATCH" gqlgen:"emailMATCH"`
}

func (*UserFilterOr) WhereWithAlias

func (f *UserFilterOr) WhereWithAlias(q *orm.Query, alias string) *orm.Query

type UserInput

type UserInput struct {
	DisplayName *string `json:"displayName" xml:"displayName" gqlgen:"displayName"`
	Password    *string `json:"password" xml:"password" gqlgen:"password"`
	Email       *string `json:"email" xml:"email" gqlgen:"email"`
	Role        *Role   `json:"role" xml:"role" gqlgen:"role"`
	Activated   *bool   `json:"activated" xml:"activated" gqlgen:"activated"`
}

func (*UserInput) ApplyUpdate

func (input *UserInput) ApplyUpdate(q *orm.Query) (*orm.Query, error)

func (*UserInput) IsEmpty

func (input *UserInput) IsEmpty() bool

func (*UserInput) Sanitize

func (input *UserInput) Sanitize() *UserInput

func (*UserInput) ToUser

func (input *UserInput) ToUser() *User

Jump to

Keyboard shortcuts

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