youtuber-description-links icon indicating copy to clipboard operation
youtuber-description-links copied to clipboard

Need to abstract the business logic from services in modules.

Open nataneb32 opened this issue 4 years ago • 6 comments

You should use some file structure and separe, in modules, which implementation.

I would sujest to use pkg and cmd.

cmd/
  There is the clients, that consumes the application API.
pkg/
  There is the application with each module.

Example

cmd/
  cli/
    main.go
pkg/
  youtube/
    repo.go
  application/
    app.go
  video/
    video.go
    description.go
    interfaces.go
  

in the cmd/cli/main.go should be something like that.

package main

import (
  "module.org/pkg/application"
  "os"
)

func main() {
  application.run(os.Args)
}

nataneb32 avatar Sep 23 '20 06:09 nataneb32

You should use some file structure and separe, in modules, which implementation.

I would sujest to use pkg and cmd.

cmd/
  There is the clients, that consumes the application API.
pkg/
  There is the application with each module.

Example

cmd/
  cli/
    main.go
pkg/
  youtube/
    repo.go
  application/
    app.go
  video/
    video.go
    description.go
    interfaces.go
  

in the cmd/cli/main.go should be something like that.

package main

import (
  "../../pkg/application"
  "os"
)

func main() {
  application.run(os.Args)
}

Dont u use models package?

ArthurFleischman avatar Sep 23 '20 22:09 ArthurFleischman

And why dont u use the full path to packages? (Cause ur using "../" paths)

ArthurFleischman avatar Sep 23 '20 22:09 ArthurFleischman

Yep. Using module is a lot better. I'm gonna edit it.

nataneb32 avatar Sep 28 '20 17:09 nataneb32

You should use some file structure and separe, in modules, which implementation. I would sujest to use pkg and cmd.

cmd/
  There is the clients, that consumes the application API.
pkg/
  There is the application with each module.

Example

cmd/
  cli/
    main.go
pkg/
  youtube/
    repo.go
  application/
    app.go
  video/
    video.go
    description.go
    interfaces.go
  

in the cmd/cli/main.go should be something like that.

package main

import (
  "../../pkg/application"
  "os"
)

func main() {
  application.run(os.Args)
}

Dont u use models package?

Inside the application.go and repository you use the model. But the main.go inside the web directory only consumes the application(application.go).

nataneb32 avatar Sep 28 '20 18:09 nataneb32

It's a good pratice in Go. A lot of go projects use this structure.

nataneb32 avatar Sep 28 '20 18:09 nataneb32

It's a good pratice in Go. A lot of go projects use this structure.

Hmmm ill try it, thanks!

ArthurFleischman avatar Oct 04 '20 00:10 ArthurFleischman