func New(username string, password string, isAdmin bool) (u *User, err error) { u = &User{Uuid: uuid.New(), Username: username, Password: password, Admin: isAdmin} if err = u.Save(); err != nil { u = nil } return }
func (u *User) SetUuid() (err error) { if d, err := DBConnect(); err == nil { defer d.Close() if uu, err := d.GetUuid(u.Username); err == nil { u.Uuid = uu return nil } else { u.Uuid = uuid.New() if err := d.Insert(u); err != nil { return err } } } return }
func (node *Node) setId() { node.Id = uuid.New() return }