This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package calculator | |
| import "context" | |
| type operation struct { | |
| SavedNumber int | |
| } | |
| // Add is method implementation to add number with saved number | |
| func (s *operation) Add(ctx context.Context, number int) (int, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package calculator_test | |
| import ( | |
| "context" | |
| "testing" | |
| "github.com/ridhoperdana/calculator" | |
| ) | |
| func TestSempoa_Add(t *testing.T) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/ridhoperdana/calculator" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BINARY=crawler | |
| # Installing dependency | |
| .PHONY: vendor | |
| go mod vendor | |
| # Linter | |
| .PHONY: vendor lint-prepare | |
| lint-prepare: | |
| @echo "Installing golangci-lint" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package models | |
| import ( | |
| "time" | |
| ) | |
| // Article represent the article model | |
| type Article struct { | |
| ID int64 `json:"id"` | |
| Title string `json:"title" validate:"required"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scalar Time | |
| type Article { | |
| ID: Int | |
| Title: String | |
| Content: String | |
| UpdatedAt: Time | |
| CreatedAt: Time | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package article | |
| import ( | |
| "context" | |
| "github.com/ridhoperdana/go-clean-arch/models" | |
| ) | |
| // Usecase represent the article's usecases | |
| type Usecase interface { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Query { | |
| FetchArticle(after: String, first: Int): ArticlesResult | |
| GetArticleByID(id: Int): Article | |
| GetArticleByTitle(title: String): Article | |
| } | |
| type Mutation { | |
| UpdateArticle(id: Int, title: String, content: String): Article | |
| StoreArticle(title: String, content: String): Article | |
| DeleteArticle(id: Int): Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Edge { | |
| cursor: String | |
| node: Article | |
| } | |
| type PageInfo { | |
| endCursor: String | |
| hasNextPage: Boolean | |
| } |
OlderNewer