Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
godzie44 committed Jul 28, 2020
2 parents c06718c + 6f9908f commit d4ba36b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,45 @@

# D3 ORM

D3 is golang ORM and DataMapper. This project was design with respect to such
ORM's like hibernate and doctrine. Main task - give an instrument for create
nice domain layer. If your business code not expressive enough, or if you want unit
tests without a database, or if in your application, for some reason, you need aggregates,
repositories, entities and value objects - d3 can be a good choice.
D3 is a golang ORM and DataMapper. This project was designed with respect to such
ORM's like hibernate and doctrine. The main task - give an instrument to create a nice domain layer. If your business code not expressive enough, or if you want unit tests without a database, or if in your application, for some reason, you need aggregates,
repositories, entities, and value objects - d3 can be a good choice.

## Motivation. Why another ORM?

In my opinion in GO have a lot of good ORM's. They are pretty fast and
may save the developer from a lot of boilerplate code. But, if you want to write code
In my opinion in GO have a lot of good ORM's. They are pretty fast and may save the developer from a lot of boilerplate code. But, if you want to write code
in DDD style (using DDD patterns and philosophy) it's not enough,
because DDD approach imposes certain requirements. Main requirement -
persistence ignorance. Current GO ORM's do not provide sufficient level of abstraction for this.
Other words, we need keep business logic free of data access code. That's why D3 created.
persistence ignorance. Current GO ORM's do not provide a sufficient level of abstraction for this.
In other words, we need to keep business logic free of data access code. That's why D3 created.

## Main futures

- code generation instead of reflection
- db schema auto generation
- one-to-one, one-to-many and many-to-many relations
- DB schema auto-generation
- one-to-one, one-to-many, and many-to-many relations
- lazy and eager relation loading
- query builder
- relation fetch strategies (eager/lazy as above or extract relation in one query with join)
- fetched entity cache (first level cache)
- cascade remove and update of related entities
- application level transaction (UnitOfWork)
- db transactions support
- smart persist layer don't generate redundant queries on entity updates
- application-level transaction (UnitOfWork)
- DB transactions support
- smart persist layer doesn't generate redundant queries on entity updates
- UUID support

## Documentation

All documentation is on project [wiki](https://github.com/godzie44/d3/wiki/Table-of-contents).
All documentation is on the project [wiki](https://github.com/godzie44/d3/wiki).

## Example of usage

Full example of usage you can see in [this](https://github.com/godzie44/last-wish) project. Note, that is it is a test project
with main responsibility show d3 orm in action.
A full example of usage you can see in [this](https://github.com/godzie44/last-wish) project. Note, that is it is a test project
with main responsibility show d3 ORM in action.

## Tests

D3 integration tests require a postgreSQL database. Connect to the database specified in the D3_PG_TEST_DB environment variable.
D3 integration tests require a PostgreSQL database. Connect to the database specified in the D3_PG_TEST_DB environment variable.

## Roadmap

Expand Down
2 changes: 1 addition & 1 deletion cmd/d3/main.go → d3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"flag"
"fmt"
d3parser "github.com/godzie44/d3/cmd/d3/parser"
d3parser "github.com/godzie44/d3/d3/parser"
"github.com/godzie44/d3/orm/gen/bootstrap"
"golang.org/x/sync/errgroup"
"os"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cmd/d3/parser/parser_test.go → d3/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestParser(t *testing.T) {
err := p.Parse("./parser_test.go")
assert.NoError(t, err)

assert.Equal(t, "github.com/godzie44/d3/cmd/d3/parser", p.PkgPath)
assert.Equal(t, "github.com/godzie44/d3/d3/parser", p.PkgPath)
assert.Equal(t, "parser", p.PkgName)
assert.Equal(t, []EntityMeta{{Name: "parsedStruct"}}, p.Metas)
}
2 changes: 1 addition & 1 deletion orm/gen/bootstrap/boot.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package bootstrap

import (
"bytes"
"github.com/godzie44/d3/cmd/d3/parser"
"github.com/godzie44/d3/d3/parser"
"go/format"
"html/template"
"io"
Expand Down
2 changes: 1 addition & 1 deletion orm/gen/bootstrap/boot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package bootstrap

import (
"bytes"
"github.com/godzie44/d3/cmd/d3/parser"
"github.com/godzie44/d3/d3/parser"
"github.com/stretchr/testify/assert"
"strings"
"testing"
Expand Down

0 comments on commit d4ba36b

Please sign in to comment.