Jam | Mata Kuliah | Dosen |
---|---|---|
08.00-10.00 | Aljabar | Mr. A |
10.00-12.00 | Inggris | Ms. B |
13.00-15.00 | Database | Mr. Y |
This file contains 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 ( | |
"fmt" | |
"log" | |
"os" | |
_runtime "runtime/pprof" | |
) | |
var ( |
This file contains 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 ( | |
"container/heap" | |
"fmt" | |
) | |
type Item struct { | |
Name string | |
Expiry int |
This file contains 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
int gcd( int a, int b){ | |
return b == 0? a: gcd(b, a%b); | |
} | |
int lcm ( int a, int b ) { | |
return (a*b)/(gcd(a,b)) | |
} |
This file contains 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 ( | |
"fmt" | |
"github.com/bxcodec/faker" | |
) | |
type SomeStruct struct { | |
Int int | |
String string |
This file contains 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
func main() { | |
conn, err := grpc.Dial("localhost:8080", grpc.WithInsecure()) | |
if err != nil { | |
fmt.Println("Unexpected Error", err) | |
} | |
defer conn.Close() | |
// CALL the NewArticleHandlerClient from generated File | |
c := article.NewArticleHandlerClient(conn) |
This file contains 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 | |
func main { | |
dbHost := config.GetString(`database.host`) | |
dbPort := config.GetString(`database.port`) | |
dbUser := config.GetString(`database.user`) | |
dbPass := config.GetString(`database.pass`) | |
dbName := config.GetString(`database.name`) | |
connection := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", dbUser, dbPass, dbHost, dbPort, dbName) | |
val := url.Values{} |
This file contains 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
// Server API for ArticleHandler service | |
type ArticleHandlerServer interface { | |
GetArticle(context.Context, *SingleRequest) (*Article, error) | |
FetchArticle(*FetchRequest, ArticleHandler_FetchArticleServer) error | |
GetListArticle(context.Context, *FetchRequest) (*ListArticle, error) | |
UpdateArticle(context.Context, *Article) (*Article, error) | |
Delete(context.Context, *SingleRequest) (*DeleteResponse, error) | |
Store(context.Context, *Article) (*Article, error) | |
} |
This file contains 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 ( | |
"github.com/bxcodec/go-clean-arch-grpc/models" | |
"github.com/bxcodec/go-clean-arch-grpc/usecase" | |
) | |
type server struct { | |
usecase usecase.ArticleUsecase | |
} |
This file contains 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
syntax = "proto3"; | |
package article ; | |
import "google/protobuf/timestamp.proto"; | |
service ArticleHandler { | |
rpc GetArticle (SingleRequest) returns (Article); | |
rpc FetchArticle (FetchRequest) returns (stream Article); | |
rpc BatchInsert (stream Article) returns (BatchInsertResponse); | |
rpc BatchUpdate (stream Article) returns (stream Article); | |
rpc GetListArticle (FetchRequest) returns (ListArticle); |