Git Product home page Git Product logo

diygoapi's Introduction

Hi there, I'm Dan Gillis

  • ๐Ÿ”ญ Iโ€™m currently working on writing a lot of Go code
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on Go
  • ๐Ÿ’ฌ Ask me about anything, I'm happy to help
  • ๐Ÿ˜„ Pronouns: he/him/his
  • โšก Fun fact: I play the drums!

Linkedin Badge Website Badge Twitter Badge Instagram Badge Medium Badge

diygoapi's People

Contributors

dependabot[bot] avatar gilcrest avatar nguyenhien1994 avatar rafaelbreno avatar theantichris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

diygoapi's Issues

Use sqlc

Figure out how to integrate sqlc with project. Find out if sqlc can work within the datastore pattern I established or abandon it and just use sqlc.

Figure out go-cloud health checkers

Dig more into go-cloud health checkers and understand how they work. Right now, app is starting when db is down and there's no alerts, etc.

Figure out GCP secrets integration with Cloud Run

Instead of setting secrets (encryption key, db username/password) through environment variables in GCP. Figure out how to integrate with GCP's Secrets Manager and Cloud Run. I believe it's pretty straightforward, actually, and should get to this soon as it's important.

TestSetReleasedOk fixes

Hey @rafaelbreno - sorry, by merging, I ended up closing the issue. If you don't mind, I'll just open a few new small issues that we can review some of the feedback from the tests you created? They look great by the way - thanks so much!

For the TestSetReleasedOk test, I believe the issue is that you're comparing the value from newReleased := time.Now(), which is a full time.Time with nanosecond precision. The SetReleased method expects a string in the RFC3339 format and parses as such:

func (m *Movie) SetReleased(r string) (*Movie, error) {
	t, err := time.Parse(time.RFC3339, r)
	if err != nil {
		return nil, errs.E(errs.Validation,
			errs.Code("invalid_date_format"),
			errs.Parameter("release_date"),
			errors.WithStack(err))
	}
	m.Released = t
	return m, nil
}

RFC3339 = "2006-01-02T15:04:05Z07:00"

RFC3339 does not have nanosecond precision, so when you send through the time.Time and format it, it's going to remove that precision.

gotMovie, _ = gotMovie.SetReleased(newReleased.Format(time.RFC3339))

and when you compare it again, you're comparing the original (newReleased) with nanosecond precision, with the return from the method without it.

	if gotMovie.Released != newReleased {
		t.Errorf("Want: %v\nGot: %v\n\n", newReleased, gotMovie.Released)
	}

Rather than use the time.Now() helper, I would send in a string as if you were receiving it from an API request in RFC3339 format. Parse that string in the test and then compare... Make sense?

Move Interfaces from Producer to Consumer

mi_losz on reddit pointed out "As for keeping the interfaces, if you import the interface from the datastore package, you're coupling the HTTP handler to this package. It can also lead to import cycles. Consider how you'd structure it if you'd like to introduce another method of saving models, like a NoSQL database"

I also was reading https://github.com/golang/go/wiki/CodeReviewComments#interfaces

Going to make changes to remove interfaces from datastore and other spots where it might make sense.

Add Observability/Telemetry

I spent some time with opencensus, opentrace and opentelemetry and decided to come back to this space later. I firmly believe in observability and plan to implement something, but feel this space has maturing to do in the open source world for Go.

On user creation, grant users movieAdmin role

RBAC is a very complicated subject. To keep things relatively simple, every user created through the /api/v1/users POST service will be granted the movieAdmin role in order to be able to create, read, update and delete movies through the API. The genesis user will be the only user granted the sysAdmin role which can call any service.

Remove wire from project

After much thought - Peter Bourgon is correct. I do not need to use wire. I like wire a lot, actually and it helped me understand dependency injection better than I did before, but it's overkill for what I'm doing.

Add real db test for server/middleware_test.go

Right now, tests that hit the db are mocked. Need to add true tests that hit the db. It will be a significant effort to enable this due to the test data setup/cleanup that will need to be in place for these tests, but it's worth it.

Create Audit struct

Instead of having create app id, create user id, create timestamp, etc. inside the Movie struct, create a separate struct as this concept should be used generally across all entities and tables.

Capture System Interacting with

I am already capturing a person's external Oauth2 bearer token in the HTTP Authorization header, but I also need to know what system/client/channel they are coming from.

Consider using X-APP-ID and an X-API-KEY (ref here) headers to denote what system/client a request is coming from.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.