domain

package
v0.0.0-...-ac266e4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	ID     uint   `gorm:"primaryKey"`
	Brand  string `gorm:"not null;type:varchar(100)"`
	Name   string `gorm:"not null;type:varchar(100)"`
	UserID uint

	CreatedAt time.Time
	UpdatedAt time.Time
}

type Student

type Student struct {
	ID       uint      `gorm:"-"`
	IDLain   uint      `gorm:"primaryKey;column:id_lain"`
	Email    string    `gorm:"not null;unique;type:varchar(100)"`
	Products []Product `gorm:"foreignKey:UserID;association_foreignkey:IDLain"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Student) BeforeCreate

func (s *Student) BeforeCreate(tx *gorm.DB) error

type User

type User struct {
	ID       int
	UserName string
	Email    string
}

type UserRepository

type UserRepository interface {
	Save(user *User) error
	GetUsers() (users []User, err error)
	FindByID(id int) (*User, error)

	SaveGormStudent(gormStudent Student) error
	GetGormStudent(id int) (Student, error)

	UpdateGormStudent(gormStudent Student) error
}

Jump to

Keyboard shortcuts

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