cutie

module
v0.0.0-...-7ce84cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2021 License: Apache-2.0

README

cutie

cutie is an opinionated go code generator for database models born out of a zealous drive to enforce separation and types for maintainability and testability. It is still a work in progress.

It's core design can be found in DESIGN.md.

Present capabilities

cutie currently supports the generation of the database models from PostgresSQL schemas with sqlc along with mocks with gomock. At present, cutie expects users to supply their own application and API models. The future plan of cutie is to also generate protobuf messages for API and integrate with the models from the other layers.

Components

pg_dump

pg_dump produces the SQL schema required for sqlc to generate model code. The lack of migration engine means cutie can work with existing databases created by any migration engines, and continue to be agnostic of related tools.

sqlc

sqlc generates type-safe go model and query code from raw SQL. This might be preferred over ORM as it ensures not only the models but also the query parameters are type-checked.

gomock

gomock creates mock implementations of the query interfaces generated by sqlc.

Directories

Path Synopsis
examples
computer_parts/dbmodels/cpu/mock_cpu
Package mock_cpu is a generated GoMock package.
Package mock_cpu is a generated GoMock package.
computer_parts/dbmodels/harddrive/mock_harddrive
Package mock_harddrive is a generated GoMock package.
Package mock_harddrive is a generated GoMock package.
computer_parts/dbmodels/make/mock_make
Package mock_make is a generated GoMock package.
Package mock_make is a generated GoMock package.
twitter/dbmodels/twitter_tweet/mock_twitter_tweet
Package mock_twitter_tweet is a generated GoMock package.
Package mock_twitter_tweet is a generated GoMock package.
twitter/dbmodels/twitter_user/mock_twitter_user
Package mock_twitter_user is a generated GoMock package.
Package mock_twitter_user is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL