func (app *App) GetUUID() (string, error) {
	if app.UUID != "" {
		return app.UUID, nil
	}
	uuidV4, err := uuid.NewV4()
	if err != nil {
		return "", errors.WithMessage(err, "failed to generate uuid v4")
	}
	conn, err := db.Conn()
	if err != nil {
		return "", err
	}
	defer conn.Close()
	err = conn.Apps().Update(bson.M{"name": app.Name}, bson.M{"$set": bson.M{"uuid": uuidV4.String()}})
	if err != nil {
		return "", err
	}
	app.UUID = uuidV4.String()
	return app.UUID, nil
}
func (app *App) GetUUID() (string, error) {
	if app.UUID != "" {
		return app.UUID, nil
	}
	uuidV4, err := uuid.NewV4()
	if err != nil {
		return "", errors.WithMessage(err, "failed to generate uuid v4")
	}
	conn, err := db.Conn()
	if err != nil {
		return "", err
	}
	defer conn.Close()
	err = conn.Apps().Update(bson.M{"name": app.Name}, bson.M{"$set": bson.M{"uuid": uuidV4.String()}})
	if err != nil {
		return "", err
	}
	app.UUID = uuidV4.String()
	return app.UUID, nil
}
func ( app * App ) GetUUID ( ) ( string , error ) { if app . UUID != " " { return app . UUID , nil } uuidV4 , err := uuid . NewV4 ( ) if err != nil { return " " , errors . WithMessage ( err , " " ) } conn , err := db . Conn ( ) if err != nil { return " " , err } defer conn . Close ( ) err = conn . Apps ( ) . Update ( bson . M { " " : app . Name } , bson . M { " " : bson . M { " " : uuidV4 . String ( ) } } ) if err != nil { return " " , err } app . UUID = uuidV4 . String ( ) return app . UUID , nil }
// GetUUID returns the app v4 UUID. An UUID will be generated
// if it does not exist.
GetUUID returns the app v4 UUID . An UUID will be generated if it does not exist .