gamma's Introduction
gamma's People
gamma's Issues
PM is slacking
when was the last time he reviewed some code. where are the unit tests? we want some coverage? @rynoson can I dm on slack what is wrong with you?
FEATURE: Find me a wife
Get to freaking work
Great work Daniel
No issue just wanted to let you know you are doing a good job @dkasabovn
Screw You Gabe
What are you even doing ?
Get to work
Code is not done
Tidy up PG Methods
Some of the models may not be up to date make sure models match the sql file
Within our pg methods some of the sql statements are getting messy.
I want you to tidy them up reordering the models and sql statements.
For example:
type User struct {
Id int
Uuid string
Email string
PhoneNumber string
ImageUrl string
FirstName string
LastName string
UserName string
PasswordHash string
}
Is out of wack in terms of ordering. We should put all fields within user in order of importance. I would reorder from top to bottom in this way: Id, Uuid, PasswordHash, Email, PhoneNumber, UserName, FirstName, LastName, ImageUrl
In essence we want to make sure that the top of the struct contains the most important fields and the bottom contains less important fields.
From here we need the order of these fields to correspond with our sql statements.
Here is the current code for getting a user:
func (u *userRepo) GetUser(ctx context.Context, uuid string) (*bo.User, error) {
statement := "SELECT uuid, email, first_name, last_name, username, phone_number, image_url FROM users WHERE uuid = $1"
res := u.dbInstance.QueryRowContext(ctx, statement, uuid)
if res.Err() != nil {
log.Errorf("could not get user by uuid: %s", res.Err().Error())
return nil, res.Err()
}
var user bo.User
if err := res.Scan(
&user.Uuid,
&user.Email,
&user.FirstName,
&user.LastName,
&user.UserName,
&user.PhoneNumber,
&user.ImageUrl,
); err != nil {
log.Errorf("could not scan res into user object: %v", err)
return nil, err
}
return &user, nil
}
The sql statement does not list out columns in the same order as our struct. I.E. in our current struct first_name
does not come after email
.
This is quite messy. The same goes with the order of the scan parameters.
Basically what I want you to do is to go through objects in app/domain/bo and reorder their values, then fix our sql statements and scans to reflect this new order. *Also make sure that the function parameters are in this order, as in the first line of the above code excerpt.
You can start with user, but in the end you should refactor everything.
Do not worry about fixing any other repo errors, as changing all function definitions will cause everything to bug. Just change them and push to a separate git branch
Smol Git Tutorial so you don't push to master:
git clone <this repos url>
git checkout -b hw/tidy-pg
# when you're done
git add -A
git commit -m "<commit message>"
git push origin hw/tidy-pg
Do something
Please
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.