123456789101112131415161718 |
- package repo
- import (
- "mats/db/model"
- "go.mongodb.org/mongo-driver/bson/primitive"
- )
- func AddProject(ctx *RepoSession, d *model.Project) (string, error) {
- coll := ctx.Client.GetCollection(CollectionProject)
- result, err := coll.InsertOne(ctx.Ctx, d)
- if err != nil {
- return "", err
- }
- return result.InsertedID.(primitive.ObjectID).Hex(), nil
- }
|