orus-io / yago Goto Github PK
View Code? Open in Web Editor NEWYet Another Go ORM. A non-empty interface and generated code based ORM for golang
License: MIT License
Yet Another Go ORM. A non-empty interface and generated code based ORM for golang
License: MIT License
The Query.All() function is wrong:
We want an api that:
Hey,
When updating to the latest version, I get the message in the title:
habba@zouzou-asus-laptop:~$ go get -u github.com/orus-io/yago
# github.com/orus-io/yago
Dev/go/src/github.com/orus-io/yago/db.go:93: db.Engine.Close() used as value
Seems to come from rev c904eaa.
Hi,
The "try it out" section of the README contains the command:
go install github.com/orus-io/cmd/yago
It should instead be:
go install github.com/orus-io/yago/cmd/yago
Hi,
I can declare a foreign key with the following yago instruction:
`yago:"fk=Account ONDELETE RESTRICT"`
But I can't use SET NULL
: the generate
program only writes a OnDelete("SET")
next to the qb.ForeignKey
instruction into the generated yago file, which is invalid.
Hi,
With the following model def:
// Model of the database
type Model struct {
Meta *yago.Metadata
RoutingEntry RoutingEntryModel
}
// RoutingEntry is an entry of the routing table
//yago:routing_table
type RoutingEntry struct {
Key string `yago:"primary_key"`
Value string `yago:"."`
}
// NewModel initialize a Model
func NewModel() *Model {
meta := yago.NewMetadata()
return &Model{
Meta: meta,
RoutingEntry: NewRoutingEntryModel(meta),
}
}
The following code is generated:
// Scan a struct
func (mapper RoutingEntryMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error {
s, ok := instance.(*RoutingEntry)
if !ok {
panic(fmt.Sprintf(
"Wrong struct type passed to the mapper. Expected &RoutingEntry{}, got %s",
reflect.TypeOf(instance).Name(),
))
}
if err := rows.Scan(
&s.Key,
&s.Value,
); err != nil {
return err
}
return nil
}
The latest github.com/golang/lint/golint complains:
model_yago.go:151:2: redundant if ...; err != nil check, just return error instead.
-> Should be simplified to:
// Scan a struct
func (mapper RoutingEntryMapper) Scan(rows *sql.Rows, instance yago.MappedStruct) error {
s, ok := instance.(*RoutingEntry)
if !ok {
panic(fmt.Sprintf(
"Wrong struct type passed to the mapper. Expected &RoutingEntry{}, got %s",
reflect.TypeOf(instance).Name(),
))
}
err := rows.Scan(
&s.Key,
&s.Value,
)
return err
}
what are you using to manage the migrations
https://github.com/gobuffalo/pop has code to gen the migrations... Might be cool to add.
The multi-column primary-key support is broken.
When generating code, the result will not compile.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.