Tinkering #755
Replies: 1 comment
-
First, thanks for the comment and the work you've done! I think the best way to do it would be to create issues for each feature, for example one issue about adding a Then we can discuss if we want to add the feature or not (personally I do want to have the Select feature, for the other stuff I'm not sure if it's worth but happy to discuss), we can then quickly decide about the implementation and then a small PR adding just that feature and closing the tracking issue would be the perfect workflow. I'll be happy to review your code as well, ideally adding tests would be important as well, but I can also help with this. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I've created a fork of this project (because I didn't want to mess it up) to use in a port of my nodejs-project. So far I've created a few extensions/extra functions. Code examples from my movie manager
.Select:
episodes, err := global.DB.Episode.FindMany(db.Episode.ShowID.Equals(id)). Select([]string{"name", "id", "episodeNumber", "seasonNumber", "progress", "owned"}). With(db.Episode.VideoFiles.Fetch(). Select([]string{"id", "extension"}). With(db.VideoFile.Subtitles.Fetch())). Exec(context.Background())
i.e. you can add a string list with fields that should be retrieved from the database. The downside is that there's no checking of the field names this way.
ExecJson(context) - Replacement for Exec that returns raw json directly from the prisma engine. This in combination with Select above allows you to strip out unset fields in the returned data
Connect, version or Link (if I've missed this functionality in the existing code I apologize)
first create/get an array of models
var genreArray = []*db.GenreModel{} for _, genre := range movie.Genres { g, err := createGenre(genre) if err == nil { genreArray = append(genreArray, g) } }
Then connect/link it in one go (db.Movie.Genres.Connect below):
`
m, err = DB.Movie.CreateOne(
db.Movie.ID.Set(movie.ID),
My question is if this is something that's you want in the main project, and if so, how do you want branches/PRs? One per feature?
(as a sidenote, please be kind to my code, have been at this Go-thing for about two weeks so still a newbie in this language)
Beta Was this translation helpful? Give feedback.
All reactions