Upgrade to Pro — share decks privately, control downloads, hide ads and more …

State normalization (RU)

Avatar for DAloG DAloG
September 28, 2019

State normalization (RU)

Avatar for DAloG

DAloG

September 28, 2019
Tweet

More Decks by DAloG

Other Decks in Programming

Transcript

  1. struct Post { let id: ID let author: User.ID let

    comments: [Comment.ID] let text: String struct ID: Hashable { let value: String } }
  2. struct User { let id: ID let posts: [Post.ID] let

    comments: [Comment.ID] let name: String let avatar: URL struct ID: Hashable { let value: String } }
  3. struct Comment { let id: ID let author: User.ID let

    post: Post.ID let text: String struct ID: Hashable { let value: String } }
  4. struct State { let posts: [Post.ID: Post] let users: [User.ID:

    User] let comments: [Comment.ID: Comment] let feed: [Post.ID] let currentUser: User.ID }