Move function body generation into codegen package (#35)
* Move function body generation into codegen package
This commit is contained in:
parent
b00c2ac77a
commit
bdb63c8129
23 changed files with 3795 additions and 2642 deletions
|
@ -33,8 +33,16 @@ func (r *UserRepositoryMongo) FindByID(arg0 context.Context, arg1 primitive.Obje
|
|||
func (r *UserRepositoryMongo) FindByGenderNotAndAgeLessThan(arg0 context.Context, arg1 Gender, arg2 int) (*UserModel, error) {
|
||||
cursor, err := r.collection.Find(arg0, bson.M{
|
||||
"$and": []bson.M{
|
||||
{"gender": bson.M{"$ne": arg1}},
|
||||
{"age": bson.M{"$lt": arg2}},
|
||||
{
|
||||
"gender": bson.M{
|
||||
"$ne": arg1,
|
||||
},
|
||||
},
|
||||
{
|
||||
"age": bson.M{
|
||||
"$lt": arg2,
|
||||
},
|
||||
},
|
||||
},
|
||||
}, options.Find().SetSort(bson.M{}))
|
||||
if err != nil {
|
||||
|
@ -49,7 +57,9 @@ func (r *UserRepositoryMongo) FindByGenderNotAndAgeLessThan(arg0 context.Context
|
|||
|
||||
func (r *UserRepositoryMongo) FindByAgeLessThanEqualOrderByAge(arg0 context.Context, arg1 int) ([]*UserModel, error) {
|
||||
cursor, err := r.collection.Find(arg0, bson.M{
|
||||
"age": bson.M{"$lte": arg1},
|
||||
"age": bson.M{
|
||||
"$lte": arg1,
|
||||
},
|
||||
}, options.Find().SetSort(bson.M{
|
||||
"age": 1,
|
||||
}))
|
||||
|
@ -65,7 +75,9 @@ func (r *UserRepositoryMongo) FindByAgeLessThanEqualOrderByAge(arg0 context.Cont
|
|||
|
||||
func (r *UserRepositoryMongo) FindByAgeGreaterThanOrderByAgeAsc(arg0 context.Context, arg1 int) ([]*UserModel, error) {
|
||||
cursor, err := r.collection.Find(arg0, bson.M{
|
||||
"age": bson.M{"$gt": arg1},
|
||||
"age": bson.M{
|
||||
"$gt": arg1,
|
||||
},
|
||||
}, options.Find().SetSort(bson.M{
|
||||
"age": 1,
|
||||
}))
|
||||
|
@ -81,7 +93,9 @@ func (r *UserRepositoryMongo) FindByAgeGreaterThanOrderByAgeAsc(arg0 context.Con
|
|||
|
||||
func (r *UserRepositoryMongo) FindByAgeGreaterThanEqualOrderByAgeDesc(arg0 context.Context, arg1 int) ([]*UserModel, error) {
|
||||
cursor, err := r.collection.Find(arg0, bson.M{
|
||||
"age": bson.M{"$gte": arg1},
|
||||
"age": bson.M{
|
||||
"$gte": arg1,
|
||||
},
|
||||
}, options.Find().SetSort(bson.M{
|
||||
"age": -1,
|
||||
}))
|
||||
|
@ -97,7 +111,10 @@ func (r *UserRepositoryMongo) FindByAgeGreaterThanEqualOrderByAgeDesc(arg0 conte
|
|||
|
||||
func (r *UserRepositoryMongo) FindByAgeBetween(arg0 context.Context, arg1 int, arg2 int) ([]*UserModel, error) {
|
||||
cursor, err := r.collection.Find(arg0, bson.M{
|
||||
"age": bson.M{"$gte": arg1, "$lte": arg2},
|
||||
"age": bson.M{
|
||||
"$gte": arg1,
|
||||
"$lte": arg2,
|
||||
},
|
||||
}, options.Find().SetSort(bson.M{}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -112,8 +129,12 @@ func (r *UserRepositoryMongo) FindByAgeBetween(arg0 context.Context, arg1 int, a
|
|||
func (r *UserRepositoryMongo) FindByGenderOrAge(arg0 context.Context, arg1 Gender, arg2 int) ([]*UserModel, error) {
|
||||
cursor, err := r.collection.Find(arg0, bson.M{
|
||||
"$or": []bson.M{
|
||||
{"gender": arg1},
|
||||
{"age": arg2},
|
||||
{
|
||||
"gender": arg1,
|
||||
},
|
||||
{
|
||||
"age": arg2,
|
||||
},
|
||||
},
|
||||
}, options.Find().SetSort(bson.M{}))
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue