Swanros.com

Notes on stuff, and thoughts on software development.

Self-referencing many-to-many relationships using Gorm in Go(lang)

Recently I had to do this, and couldn't figure out how to do it (maybe I need to start reading documentation more closely). But I found the way to do it:

type User struct {  
        Id       int64
        Contacts []User `gorm:"foreignkey:user_id;associationforeignkey:contact_id;many2many:user_contacts;"`
    }
    

Re: React Native

I've been reading a lot about React Native.

From the latest piece I read:

It's early and if you don't have a lot free time or care to be on the bleeding edge, I'd recommend waiting a bit before using it to develop a production app.

Reading is all I've done so far, and I do want to start experimenting with it, but haven't had much time. Fortunately, I have 2 weeks of vacation time ahead of me, so hopefuly I'll be able to spend some time playing around with it.

As I've said before, I don't really like JavaScript as a language, but if I'm going to learn it, it is going to be to use React. The comments I've seen of it all seem positive, both for the web version and for the native initiative.

Even if I don't dive right in, at a minimum I'll keep up with it's progress via rss feeds and twitter.

Stole my words.

› NSHipster, Second Edition

A new edition of the NSHipster's book is going to be available April 15th, this time covering Swift.

Preorder here.

› What Engineers At Facebook, Pinterest, Snapchat, Airbnb, And Spotify Listen To While Coding

Great music selection, if you ask me. Read here.

› Introducing ComponentKit

So, Facebook announced ComponentKit yesterday.

ComponentKit takes a functional, declarative approach to building UI and emphasizes a one-way data flow from immutable models to immutable components that describe how views should be configured.

Its great to see that Facebook contributes this much to the open source community. It really is.

But, how many UI libraries does Facebook need?