entity

package
v0.0.0-...-9a6ce2f Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task struct {
	ID       uuid.UUID `json:"id" gorm:"type:char(36);primary_key"`
	Task     string    `json:"task"`
	Finished bool      `json:"finished"`
	UserID   string    `json:"userId"`
	// User      User            `json:"user" gorm:"foreignKey:UserID"`
	CreatedAt time.Time       `json:"createdAt"`
	UpdatedAt *time.Time      `json:"updatedAt"`
	DeletedAt *gorm.DeletedAt `json:"deletedAt" gorm:"index"`
}

func (*Task) BeforeCreate

func (t *Task) BeforeCreate(tx *gorm.DB) (err error)

type TaskRepository

type TaskRepository interface {
	Create(task *Task) error
	Update(task *Task) error
	Get(id string) (*Task, error)
	GetAll() ([]*Task, error)
	Delete(task *Task) error
}

type User

type User struct {
	ID        uuid.UUID       `json:"id" gorm:"type:char(36);primary_key"`
	Username  string          `json:"username" gorm:"unique"`
	Name      string          `json:"name"`
	Email     string          `json:"email" gorm:"unique"`
	Password  string          `json:"-"`
	Tasks     []Task          `json:"tasks"`
	CreatedAt time.Time       `json:"createdAt"`
	UpdatedAt *time.Time      `json:"updatedAt"`
	DeletedAt *gorm.DeletedAt `json:"deletedAt" gorm:"index"`
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

type UserRepository

type UserRepository interface {
	Create(user *User) error
	GetById(id string) (*User, error)
}

Jump to

Keyboard shortcuts

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