시리즈: Go
go
37 줄
· 업데이트 2026-04-18
goods.go
Go/Baasid/internal/models/goods.go
package models
import (
"time"
"github.com/google/uuid"
)
// Goods maps to table "goods" (商品).
//
// The public REST API exposes JSON field names "_id" and "goods_name", while
// the physical column for the product title is "name" per the data
// dictionary in the specification.
type Goods struct {
// ID is the product UUID, column "_id".
ID uuid.UUID `gorm:"column:_id;type:uuid;primaryKey;default:gen_random_uuid()"`
// Name is the product name (商品名稱), column "name".
Name string `gorm:"column:name;size:128;not null"`
// CrUser is the creator's system_user._id (外鍵).
CrUser uuid.UUID `gorm:"column:cr_user;type:uuid;not null"`
// CrDatetime defaults to creation time.
CrDatetime time.Time `gorm:"column:cr_datetime;autoCreateTime"`
// UpUser is the last updater's system_user._id (外鍵).
UpUser uuid.UUID `gorm:"column:up_user;type:uuid;not null"`
// UpDatetime is maintained by GORM on each update.
UpDatetime time.Time `gorm:"column:up_datetime;autoUpdateTime"`
}
// TableName tells GORM the physical table name.
func (Goods) TableName() string {
return "goods"
}
관련 글
Go
go
업데이트 2026-04-18
main.go
main.go — go source code from the Go learning materials (Go/Baasid/cmd/hashpw/main.go).
글 읽기 →
Go
go
업데이트 2026-04-18
main.go
main.go — go source code from the Go learning materials (Go/Baasid/cmd/server/main.go).
글 읽기 →
Go
go
업데이트 2026-04-18
docs.go
docs.go — go source code from the Go learning materials (Go/Baasid/docs/docs.go).
글 읽기 →
Go
go
업데이트 2026-04-18
jwt.go
jwt.go — go source code from the Go learning materials (Go/Baasid/internal/auth/jwt.go).
글 읽기 →
Go
go
업데이트 2026-04-18
password.go
password.go — go source code from the Go learning materials (Go/Baasid/internal/auth/password.go).
글 읽기 →
Go
go
업데이트 2026-04-18
password_test.go
password_test.go — go source code from the Go learning materials (Go/Baasid/internal/auth/password_test.go).
글 읽기 →