package entity import ( "git.sxidc.com/go-tools/utils/strutils" ) type Base struct { ID string `sqlmapping:"column:id;key;" sqlresult:"column:id;" check:"required,len=32,when=create/delete/update"` } func (e *Base) GenerateID() error { e.ID = strutils.SimpleUUID() return nil } func (e *Base) GetID() string { return e.ID }