[go: nahoru, domu]

Skip to content
/ yoyo Public
forked from yoyo-project/yoyo

A Database Access Layer Generator for Go

License

Notifications You must be signed in to change notification settings

dotvezz/yoyo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yoyo

MIT license Go Report Card Maintainability codecov CircleCI

A Migration Generator and Database Access Layer Generator for Go projects. Made with ❤️ to hopefully make your life a little bit easier.

Your Database access layer generated by yoyo...

  • provides a native, fluent query generator
  • is totally pure Go
  • is totally reflection-free

A Note on Using Databases in Code

Okay, accessing databases in code is annoying. Relational data is annoying. It doesn't matter which language you're using. It doesn't matter if you're using PostgreSQL, MySQL, or Clickhouse, there's an innate complexity in relational data that is simply not native to Go or most other general purpose programming languages. That's why many of us turn to tools like ORMs, choosing to accept the cons of ORM magic because of the pros of having something else do the translation.

While yoyo is not an ORM, it is meant to address the same problem in a different way. By generating a database access layer with entities for your project, tailor-made to your schema and without any reflection in sight.

What does yoyo do?

yoyo is a code-generation tool which really does two things:

  • Help manage your schema by generating migrations.
  • Help you work with your schema by generating database access layer code in your project.

Usage

yoyo generate

Stability: Experimental

yoyo's main function is generating database access code.

yoyo reverse

Stability: Experimental

Read an existing database and attempt to translate it to a schema in yoyo.yml

yoyo generate migration

Stability: Experimental

Configuration

Configuration for yoyo is kept in your project's yoyo.yml file.

Managing Database Connections

When running or generating migrations, Yoyo's connection to your database is environment-driven and managed internally.

When running as a part of your app, Yoyo cedes control for your flexibility. Therefore, it needs to be handed a connection in the form of a *sql.DB.

What Yoyo can't do

  • Anything that crosses into another database. Yoyo is a single-database (single-schema) tool, so something like a MySQL Foreign Key that references a table in a different schema won't work in Yoyo.

About

A Database Access Layer Generator for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%