MCPcopy Create free account
hub / github.com/53AI/53AIHub / Validate

Method Validate

api/model/like.go:36–47  ·  view source on GitHub ↗

Validate 数据验证

()

Source from the content-addressed store, hash-verified

34
35// Validate 数据验证
36func (l *Like) Validate() error {
37 if l.UserID <= 0 {
38 return errors.New("用户ID无效")
39 }
40 if l.ObjectID <= 0 {
41 return errors.New("对象ID无效")
42 }
43 if l.Type == "" {
44 return errors.New("点赞类型不能为空")
45 }
46 return nil
47}
48
49// Create 创建点赞记录
50func (l *Like) Create() error {

Callers 1

CreateMethod · 0.95

Calls 1

NewMethod · 0.45

Tested by

no test coverage detected