models

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Code generated by "apigen"; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment added in v0.0.9

type Comment struct {
	ID         int       `json:"id"`
	QuestionID int       `json:"question_id"`
	Comments   []Comment `json:"comments" gorm:"many2many:comment_comments"`
}

Test recursion

type Issue

type Issue struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type Question added in v0.0.9

type Question struct {
	ID       int       `json:"id"`
	Comments []Comment `json:"comments" gorm:"many2many:question_comments"`
}

apigen:skip

type Role

type Role struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Gender Sex    `json:"gender"`
}

type Sex

type Sex string
const (
	Male   Sex = "Male"
	Female Sex = "Female"
)

func (Sex) DatabaseType

func (e Sex) DatabaseType() string

func (Sex) GormDataType added in v0.0.6

func (e Sex) GormDataType() string

func (Sex) IsValid

func (e Sex) IsValid() bool

func (*Sex) Scan

func (e *Sex) Scan(src interface{}) error

func (Sex) ValidValues

func (e Sex) ValidValues() []string

func (Sex) Value

func (e Sex) Value() (driver.Value, error)

type Tag

type Tag struct {
	ID     int64   `json:"id"`
	Name   string  `json:"name"`
	Issues []Issue `gorm:"many2many:tag_issues" json:"issues"`

	RoleID int64 `json:"role_id" gorm:"not null"`
	Role   Role  `json:"role" gorm:"foreignKey:RoleID"`
}

type User

type User struct {
	ID       int     `json:"id" gorm:"autoIncrement"`
	Name     string  `json:"name" gorm:"default:''"`
	Age      int     `json:"age"`
	Discount float64 `json:"discount" gorm:"constraint:positive_discount CHECK (discount > 0)"`
	RoleID   int64   `json:"role_id" gorm:"not null"`
	Role     Role    `json:"role" gorm:"foreignKey:RoleID"`
	Tags     []Tag   `json:"tags" gorm:"many2many:user_tags"`
}

Jump to

Keyboard shortcuts

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