Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-node@v1
with:
# choose node.js version to use
node-version: '14'
node-version: '16'

# cache node_modules
- name: Cache dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
uses: actions/checkout@v3

- name: Run Linters
uses: golangci/golangci-lint-action@v3.3.1
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.50.1
version: v1.54.1
args: --verbose
tests:
name: Tests with coverage
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export GO111MODULE=on

format-check: ## Format the code and run linters
@if test ! -e ./bin/golangci-lint; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.52.0; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.54.1; \
fi
@./bin/golangci-lint run --fix

Expand All @@ -14,4 +14,7 @@ init:
cd ./example && go run github.com/99designs/gqlgen init

hitrix:
./example/docker/services.sh hitrix
./example/docker/services.sh server

single-instance-cron:
./example/docker/services.sh single-instance-cron
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hitrix

[![checks & tests](https://github.com/coretrix/hitrix/actions/workflows/main.yml/badge.svg)](https://github.com/coretrix/hitrix/actions)
[![checks & tests](https://github.com/coretrix/clockwork/actions/workflows/main.yml/badge.svg)](https://github.com/coretrix/clockwork/actions)
[//]: # ([![checks & tests](https://github.com/coretrix/hitrix/actions/workflows/main.yml/badge.svg)](https://github.com/coretrix/hitrix/actions))
[![codecov](https://codecov.io/gh/coretrix/hitrix/branch/main/graph/badge.svg)](https://codecov.io/gh/coretrix/hitrix)
[![Go Report Card](https://goreportcard.com/badge/github.com/coretrix/hitrix)](https://goreportcard.com/report/github.com/coretrix/hitrix)
[![GPL3 license](https://img.shields.io/badge/license-GPL3-brightgreen.svg)](https://opensource.org/licenses/GPL-3.0)
Expand Down
18 changes: 18 additions & 0 deletions datalayer/orm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package datalayer

import (
redisearch "github.com/coretrix/beeorm-redisearch-plugin"
"github.com/latolukasz/beeorm/v2"

Check failure on line 5 in datalayer/orm.go

View workflow job for this annotation

GitHub Actions / Quality & Security checks

could not import github.com/latolukasz/beeorm/v2 (-: # github.com/latolukasz/beeorm/v2
)

type ORM struct {
beeorm.Engine

Check failure on line 9 in datalayer/orm.go

View workflow job for this annotation

GitHub Actions / Quality & Security checks

undefined: beeorm (typecheck)
*redisearch.RedisSearchEngine
}

func (d *ORM) Clone() *ORM {
return &ORM{
Engine: d.Engine.Clone(),
RedisSearchEngine: d.RedisSearchEngine,
}
}
4 changes: 2 additions & 2 deletions docs/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ If you want to use our dev panel and to be able to manage alters, error log, red
package entity

import (
"github.com/latolukasz/beeorm"
"github.com/latolukasz/beeorm/v2"
)

type DevPanelUserEntity struct {
Expand All @@ -160,7 +160,7 @@ After that you should register it to the `entity.Init` function
```go
package entity

import "github.com/latolukasz/beeorm"
import "github.com/latolukasz/beeorm/v2"

func Init(registry *beeorm.Registry) {
registry.RegisterEntity(
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/guide/features/seeder.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This `DBSeedScript` needs to be provided a `Seeds map[string][]Seed` field, Wher
The Script can be implemented in your app by making a type that satisfies the `Seed` interface:
```go
type Seed interface {
Execute(*beeorm.Engine)
Execute(*datalayer.DataLayer)
Environments() []string
Name() string
}
Expand All @@ -26,7 +26,7 @@ func (seed *UsersSeed) Environments() []string {
return []string{app.ModeTest, app.ModeLocal, app.ModeDev, app.ModeDemo, app.ModeProd}
}

func (seed *UsersSeed) Execute(ormService *beeorm.Engine) {
func (seed *UsersSeed) Execute(ormService *datalayer.DataLayer) {
// TODO insert a new user entity to the db
}
```
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/guide/services/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ service.DI().Authentication()
`AppleService` # optional , when you need to support apple login

```go
func Authenticate(ormService *beeorm.Engine, uniqueValue string, password string, entity AuthProviderEntity) (accessToken string, refreshToken string, err error) {}
func VerifyAccessToken(ormService *beeorm.Engine, accessToken string, entity beeorm.Entity) error {}
func Authenticate(ormService *datalayer.DataLayer, uniqueValue string, password string, entity AuthProviderEntity) (accessToken string, refreshToken string, err error) {}
func VerifyAccessToken(ormService *datalayer.DataLayer, accessToken string, entity beeorm.Entity) error {}
func VerifySocialLogin(ctx context.Context, source, token string, isAndroid bool)
func RefreshToken(ormService *beeorm.Engine, refreshToken string) (newAccessToken string, newRefreshToken string, err error) {}
func LogoutCurrentSession(ormService *beeorm.Engine, accessKey string){}
func LogoutAllSessions(ormService *beeorm.Engine, id uint64)
func AuthenticateOTP(ormService *beeorm.Engine, phone string, entity OTPProviderEntity) (accessToken string, refreshToken string, err error){}
func RefreshToken(ormService *datalayer.DataLayer, refreshToken string) (newAccessToken string, newRefreshToken string, err error) {}
func LogoutCurrentSession(ormService *datalayer.DataLayer, accessKey string){}
func LogoutAllSessions(ormService *datalayer.DataLayer, id uint64)
func AuthenticateOTP(ormService *datalayer.DataLayer, phone string, entity OTPProviderEntity) (accessToken string, refreshToken string, err error){}
```
1. The `Authenticate` function will take an uniqueValue such as Email or Mobile, a plain password, and generates accessToken and refreshToken.
You will also need to pass your entity as third argument, and it will give you the specific user entity related to provided access token
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guide/services/crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func ListRequest(ctx context.Context, request *hitrixCrud.ListRequest) (*city.Re
return list(service.DI().OrmEngineForContext(ctx), request)
}

func list(ormService *beeorm.Engine, request *hitrixCrud.ListRequest) (*city.ResponseDTOList, error) {
func list(ormService *datalayer.DataLayer, request *hitrixCrud.ListRequest) (*city.ResponseDTOList, error) {

// this is the function that handles the getting and making the payload fot the crud that is going to be used
// for both list (endpoint) and exporting
Expand Down Expand Up @@ -166,7 +166,7 @@ func list(ormService *beeorm.Engine, request *hitrixCrud.ListRequest) (*city.Res
**2 - Creating a new handler for exporting the data obtained from "list" function**

```go
func ListExport(ormService *beeorm.Engine, request *hitrixCrud.ListRequest, _ uint64, _ map[string]string) (error, []string, [][]interface{}) {
func ListExport(ormService *datalayer.DataLayer, request *hitrixCrud.ListRequest, _ uint64, _ map[string]string) (error, []string, [][]interface{}) {

// This function handles the data for exporting

Expand Down Expand Up @@ -282,4 +282,4 @@ and if you like to check the permissions you can get the whole config like this

```go
config, exists := crudService.GetExportConfig(CityExportID) // getting the config
```
```
4 changes: 2 additions & 2 deletions docs/docs/guide/services/geocoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ The service exposes 3 methods that you can use:

```go
type IGeocoding interface {
Geocode(ctx context.Context, ormService *beeorm.Engine, address string, language Language) (*Address, error)
ReverseGeocode(ctx context.Context, ormService *beeorm.Engine, latLng *LatLng, language Language) (*Address, error)
Geocode(ctx context.Context, ormService *datalayer.DataLayer, address string, language Language) (*Address, error)
ReverseGeocode(ctx context.Context, ormService *datalayer.DataLayer, latLng *LatLng, language Language) (*Address, error)
CutCoordinates(float float64, precision int) (float64, error)
}
```
4 changes: 2 additions & 2 deletions docs/docs/guide/services/mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ service.DI().Mail()
Some functions this service provide are:
```go
GetTemplateKeyFromConfig(templateName string) (string, error)
SendTemplate(ormService *beeorm.Engine, message *Message) error
SendTemplateWithAttachments(ormService *beeorm.Engine, message *MessageAttachment) error
SendTemplate(ormService *datalayer.DataLayer, message *Message) error
SendTemplateWithAttachments(ormService *datalayer.DataLayer, message *MessageAttachment) error
GetTemplateHTMLCode(templateName string) (string, error)
```
4 changes: 2 additions & 2 deletions docs/docs/guide/services/request_logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ service.DI().RequestLogger()

The functions this service provide are:
```go
LogRequest(ormService *beeorm.Engine, appName, url string, request *http.Request, contentType string) *entity.RequestLoggerEntity
LogResponse(ormService *beeorm.Engine, requestLoggerEntity *entity.RequestLoggerEntity, responseBody []byte, status int)
LogRequest(ormService *datalayer.DataLayer, appName, url string, request *http.Request, contentType string) *entity.RequestLoggerEntity
LogResponse(ormService *datalayer.DataLayer, requestLoggerEntity *entity.RequestLoggerEntity, responseBody []byte, status int)
```
They can be used to log any outgoing requests you send

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ package model
type PriceChangedDirtyAllProducer struct {
}

func (p *PriceChangedDirtyAllProducer) Produce(ormService *beeorm.Engine) error {
func (p *PriceChangedDirtyAllProducer) Produce(ormService *datalayer.DataLayer) error {
variantEntity := entity.VariantEntity{}
where := beeorm.NewWhere("1 ORDER BY ID ASC")
pager := &beeorm.Pager{CurrentPage: 1, PageSize: 1000}
Expand Down Expand Up @@ -178,4 +178,4 @@ We have defined rules that backend and frontend developers should follow to keep
- When backend developer is done and all tests pass he should test every endpoint by himself using `swagger` on `dev` environment before complete his ticket
- When frontend developer is done he should deploy on `dev` and test the feature very well before complete his ticket
5. When everything works on `dev` frontend developer is responsible to talk to backend developer and together to deploy on `demo` and go through the flow and verify if it works
6. Mark the task as completed and inform the business person.
6. Mark the task as completed and inform the business person.
Loading
Loading