Skip to content

Instantly share code, notes, and snippets.

View VictorKabata's full-sized avatar
💻
Knock, knock. Race condition. Who's there?

Victor Kabata VictorKabata

💻
Knock, knock. Race condition. Who's there?
View GitHub Profile
rootQuery := graphql.ObjectConfig{
Name: "RootQuery",
Fields: fields,
}
fields := graphql.Fields{
"notes": &graphql.Field{
Name: "Get all notes",
Type: graphql.NewList(noteType),
Description: "Get list of all notes",
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
return notes, nil
},
},
func main() {
fmt.Println("Starting graphql server...")
noteType := graphql.NewObject(
graphql.ObjectConfig{
Name: "Note",
Description: "User generated note",
Fields: graphql.Fields{
"id": &graphql.Field{
Type: graphql.Int,
type Note struct {
ID int `json: "id"`
Title string `json: "title"`
Description string `json: "description"`
Created_At string `json: "created_at"`
}
/**Mock database*/
var notes = []Note{
{1, "Title 1", "Description 1", time.Now().UTC().String()},
func main() {
fmt.Println("Starting graphql server...")
}
//Retrieves movie detail based on id from SQLite. If not available makes a network call to retrieve movie details from API
suspend fun getMovieDetails(movieId: Int): Flow<MovieDetails> {
val movieDetailsCacheResponse:Flow<MovieDetailsEntity>? = appDatabase.movieDetailsDao().getPopularShows(movieId)
return if (movieDetailsCacheResponse != null) {
Timber.e("MovieDetailsDataSource: Fetching movie details from cache")
return movieDetailsCacheResponse.map { it?.toDomain() }
} else {
Timber.e("MovieDetailsDataSource: Fetching movie details from network")
@VictorKabata
VictorKabata / multipart_upload.go
Created June 27, 2020 21:29 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"