func (a Application) CreateApplication() error { err := mongo.Insert(a) if err != nil { return err } return nil }
func (u User) CreateUser() error { hashedPassword, err := bcrypt.GenerateFromPassword([]byte(u.Password), bcrypt.DefaultCost) u.Password = string(hashedPassword) u.Token = randToken() u.Id = bson.NewObjectId() err = mongo.Insert(u) fmt.Println(err) return err }
func (u UrlRecord) CreateUrlRecord() error { u.DateCreated = time.Now() err := mongo.Insert(u) if err != nil { panic(err) } return nil }
func (u Url) CreateUrl() error { u.Id = bson.NewObjectId() mongo.Insert(u) return nil }