Skip to content

gcentauri/komi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

komi

A web app for go players to organize clubs, store and access game records, browse and comment on games, and…

Also an attempt to document the process of building a Ruby web app in 2019 using a combination of new tools. rom-rb providing persistence and dry-rb providing data and functional tools, with roda providing routing. simple, powerful tools, hopefully a simple demonstration.

Developing the game tree 2018-06-14

go here

Initial State 2018-06-06

At the moment, you just have ./bin/console to run the ./lib/main.rb script and load up the collection of games into an sqlite in-memory database.

Repositories

If I understand the documentation, a rom-repository is an abstract interface to the database relations defined in ./lib/relations. You can think of it as a place to ask for collections of structs. You can store stuff and retrieve it too, but the stuff you’re interacting with is application data, not database relations. You ask the Repo to store a record of your stuff with a ‘command’ like Repo.create({my: struct}). You define functions to use relations to fill orders for structs to pick up from the repo. You won’t do something like Model.save to save the current object directly to the DB.

A set of game records are in ./assets which main.rb uses to populate the database through the Games and Players repositories.

Games.white_wins returns an array of game structs where the white player wins.

Games.player_wins("Fujisawa Shuko") returns an array of game structs where one of my favorite players is the winner

Players.names returns array of all the unique players in this collection

Players.all returns array of all Player structs (includes rank and country)

About

Go game database exercising dry-rb and rom-rb

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages