From Cloudinary To AWS S3

There was a problem with image uploading in my Flutter project.

I initially used Cloudinary, because it was easy to apply to Flutter.

The code for Cloudinary was like the following:

Future<String> uploadFile(String filePath) async {try {final bytes = File(filePath).readAsBytesSync();String base64Encode(List<int> bytes)…

All you need to know to run Go in ubuntu 18.04

It takes time to gather information from Internet. That’s why I’m writing this article. Wish this might help someone who wants to run Go in AWS first time.

Step1. Launch EC2 instance

I will not give instruction on this. Launch instance on AWS…

What I learned today

How to export Database variable to other packages using go-pg


// package pgdbfunc DB() (Con *pg.DB) {Con = pg.Connect(options)if Con == nil {fmt.Printf(“Problem Occurred”)} else {fmt.Printf(“DB connected”)}return}// call from other packages_, err := pgdb.DB().Query(...)

This way had one drawback: Calling database by function is tiresome, because I have to type parenthesis.


// package pgdbvar Con *pg.DBfunc init() {// here are the same as before.}// call from other packages_, err := pgdb.Con.Query(..)

Official document is not too kind

I prefer raw queries to orm-based queries, but there is a sure advantage in using orm-based query, especially when inserting, updating, and deleting: Easy to read the code.

But, I still think it’s not a good idea to use orm-based queries when selecting, because…

Be careful for difference between JSON array and pg array


When you defined User type like this on schema.graphqls

type User { ID: String! profileImages: [String]}

And after you generate by

go run generate

There comes the generated model like this in models_gen.go:

type User struct {  ID string `json:”ID”`  ProfileImages []string`json:”profileImages”`}

And if you define CreateUser…

Jason Choi

Backend Developer, Pingpong

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store