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 repository | |
import models "github.com/bxcodec/go-clean-arch/article" | |
type ArticleRepository interface { | |
Fetch(cursor string, num int64) ([]*models.Article, error) | |
GetByID(id int64) (*models.Article, error) | |
GetByTitle(title string) (*models.Article, error) | |
Update(article *models.Article) (*models.Article, error) | |
Store(a *models.Article) (int64, 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
import "time" | |
type Article struct { | |
ID int64 `json:"id"` | |
Title string `json:"title"` | |
Content string `json:"content"` | |
UpdatedAt time.Time `json:"updated_at"` | |
CreatedAt time.Time `json:"created_at"` | |
} |
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
namespace users; | |
table User { | |
name : string ; | |
id : long; | |
} | |
table UserContainer { | |
ListOfUsers:[User]; |
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 http_test | |
import ( | |
"encoding/json" | |
"io/ioutil" | |
"net/http" | |
"net/http/httptest" | |
"os" | |
"strings" | |
"testing" |
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 fbs | |
import ( | |
"net/http" | |
"github.com/bxcodec/Go-Simple-Flatbuffer/users" | |
httpdlv "github.com/bxcodec/Go-Simple-Flatbuffer/users/delivery/http" | |
flatbuffers "github.com/google/flatbuffers/go" | |
"github.com/labstack/echo" | |
) |
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 fbs_test | |
import ( | |
"encoding/json" | |
"testing" | |
"github.com/bxcodec/Go-Simple-Flatbuffer/users" | |
httpdlv "github.com/bxcodec/Go-Simple-Flatbuffer/users/delivery/http" | |
"github.com/bxcodec/Go-Simple-Flatbuffer/users/delivery/http/fbs" |
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 (term *Term) Encode(version string) []byte { | |
builder := flatbuffers.NewBuilder(0) | |
// Preprocess the shotguns | |
shotguns := make([]flatbuffers.UOffsetT, len(term.Shotgun)) | |
shotgunStrs := make([]flatbuffers.UOffsetT, len(term.Shotgun)) | |
for i := 0; i < len(term.Shotgun); i++ { | |
shotgunStrs[i] = builder.CreateString(term.Shotgun[i].Term) | |
} | |
for i := 0; i < len(term.Shotgun); i++ { |
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
// automatically generated, do not modify | |
package encoder | |
import ( | |
flatbuffers "github.com/google/flatbuffers/go" | |
) | |
type Container struct { | |
_tab flatbuffers.Table | |
} |
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/saint" | |
) | |
func main() { | |
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" | |
"math" | |
) | |
func main() { | |
x := -5 | |
fmt.Println(math.Abs(float64(x))) // print : 5 | |
} |
NewerOlder