models

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TodoListType = graphql.NewObject(
	graphql.ObjectConfig{
		Name: "TodoListType",
		Fields: graphql.Fields{
			"id": &graphql.Field{
				Type: graphql.String,
			},
			"title": &graphql.Field{
				Type: graphql.String,
			},
			"created_at": &graphql.Field{
				Type: graphql.String,
			},
			"updated_at": &graphql.Field{
				Type: graphql.String,
			},
		},
	},
)
View Source
var TodoType = graphql.NewObject(
	graphql.ObjectConfig{
		Name: "TodoType",
		Fields: graphql.Fields{
			"id": &graphql.Field{
				Type: graphql.String,
			},
			"title": &graphql.Field{
				Type: graphql.String,
			},
			"completed": &graphql.Field{
				Type: graphql.Boolean,
			},
			"note": &graphql.Field{
				Type: graphql.String,
			},
			"created_at": &graphql.Field{
				Type: graphql.String,
			},
			"updated_at": &graphql.Field{
				Type: graphql.String,
			},
		},
	},
)
View Source
var UserType = graphql.NewObject(
	graphql.ObjectConfig{
		Name: "User",
		Fields: graphql.Fields{
			"id": &graphql.Field{
				Type: graphql.String,
			},
			"name": &graphql.Field{
				Type: graphql.String,
			},
			"email": &graphql.Field{
				Type: graphql.String,
			},
			"created_at": &graphql.Field{
				Type: graphql.String,
			},
			"updated_at": &graphql.Field{
				Type: graphql.String,
			},
		},
	},
)

Functions

func CreateTables

func CreateTables(db *gorm.DB)

func DropTables

func DropTables(db *gorm.DB)

func InitDb

func InitDb(host, user, password, dbName string, debug bool) *gorm.DB

func InitDbURI

func InitDbURI(connectionString string, debug bool) *gorm.DB

func InitTestDb

func InitTestDb(host, user, password, dbName string, debug bool) *gorm.DB

func InitTestDbURI

func InitTestDbURI(connectionString string, debug bool) *gorm.DB

Types

type PRIORITY

type PRIORITY int
const (
	PRIORITY_NIL PRIORITY = iota
	PRIORITY_IRRELEVANT
	PRIORITY_EXTRA_LOW
	PRIORITY_LOW
	PRIORITY_NORMAL
	PRIORITY_HIGH
	PRIORITY_URGENT
	PRIORITY_SUPER_URGENT
	PRIORITY_IMMEDIATE
)

type Todo

type Todo struct {
	ID         uuid.UUID  `gorm:"primary_key" form:"id" json:"id"`
	CreatedAt  *time.Time `gorm:"not null" form:"created_at" json:"created_at,omitempty"`
	UpdatedAt  *time.Time `gorm:"not null" form:"updated_at" json:"updated_at,omitempty"`
	Title      string     `gorm:"not null" form:"title" json:"title" binding:"required"`
	Completed  bool       `gorm:"not null" form:"completed" json:"completed"`
	Note       string     `gorm:"not null" form:"note" json:"note"`
	TodoListID uuid.UUID  `gorm:"index" form:"todo_list_id" json:"todo_list_id"`
	UserID     uuid.UUID  `gorm:"index" form:"user_id" json:"user_id"`
	DeadLineAt *time.Time `gorm:"index" form:"dead_line_at" json:"dead_line_at,omitempty"`
	Priority   PRIORITY   `gorm:"index" form:"priority" json:"priority"`
}

type TodoList

type TodoList struct {
	ID        uuid.UUID  `gorm:"primary_key" form:"id" json:"id"`
	CreatedAt *time.Time `gorm:"not null" form:"created_at" json:"created_at,omitempty"`
	UpdatedAt *time.Time `gorm:"not null" form:"updated_at" json:"updated_at,omitempty"`
	Title     string     `gorm:"not null" form:"title" json:"title" binding:"required"`
	UserID    uuid.UUID  `gorm:"index" form:"user_id" json:"user_id"`
}

type User

type User struct {
	ID        uuid.UUID  `gorm:"primary_key" form:"id" json:"id"`
	CreatedAt *time.Time `gorm:"not null" form:"created_at" json:"created_at,omitempty"`
	UpdatedAt *time.Time `gorm:"not null" form:"updated_at" json:"updated_at,omitempty"`
	Name      string     `gorm:"not null" form:"name" json:"name"`
	Email     string     `gorm:"type:varchar(100);unique_index" form:"email" json:"email" binding:"required"`
	Password  string     `gorm:"not null" form:"password" json:"password" binding:"required"`
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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