models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Post

type Post struct {
	ID          uint           `gorm:"primaryKey" json:"id"`
	Title       string         `gorm:"type:string" json:"title"`
	Description string         `gorm:"type:string" json:"description"`
	UserID      uint           `json:"user_id"`
	CreatedAt   time.Time      `gorm:"autoUpdateTime:milli" json:"created_at"`
	UpdatedAt   time.Time      `gorm:"autoUpdateTime:milli" json:"updated_at"`
	DeletedAt   gorm.DeletedAt `json:"-"`
}

func (*Post) String

func (p *Post) String() string

type User

type User struct {
	// gorm.Model /* this is the default form of declaration */
	ID           uint           `gorm:"primaryKey;unique" json:"id"`
	Name         string         `gorm:"type:string;not null" json:"name"`
	Email        string         `gorm:"type:string;not null;unique;primaryKey" json:"email"`
	HashPassword string         `gorm:"type:string;not null" json:"-"`
	CreatedAt    time.Time      `gorm:"autoUpdateTime:milli" json:"created_at"`
	UpdatedAt    time.Time      `gorm:"autoUpdateTime:milli" json:"updated_at"`
	DeletedAt    gorm.DeletedAt `json:"-"`
	Posts        []Post         `gorm:"foreignKey:UserID" json:"posts"`
}

func (*User) String

func (u *User) String() string

Jump to

Keyboard shortcuts

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