Move function body generation into codegen package ()

* Move function body generation into codegen package
This commit is contained in:
sunboyy 2023-04-18 20:21:46 +07:00 committed by GitHub
parent b00c2ac77a
commit bdb63c8129
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 3795 additions and 2642 deletions

View file

@ -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 {