-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce9ef06
commit 77f6432
Showing
10 changed files
with
88 additions
and
39 deletions.
There are no files selected for viewing
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
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
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
25 changes: 11 additions & 14 deletions
25
protoc-gen-go-crud/internal/authorization/repositories/authorization.go
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,41 @@ | ||
package repositories | ||
|
||
import ( | ||
"context" | ||
"github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/internal/authorization/entities" | ||
"github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/pkg/database" | ||
"github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/pkg/database/entity" | ||
"github.com/fynntang/protobuf-gen-go/protoc-gen-go-crud/pkg/global" | ||
) | ||
|
||
type IAuthRepo interface { | ||
CreateAuth(ctx context.Context, Auth *entities.Auth) error | ||
UpdateAuth(ctx context.Context, updateFields []string, Auth *entities.Auth) error | ||
GetAuth(ctx context.Context, id entity.ID) (*entities.Auth, error) | ||
GetAuths(ctx context.Context, filter *database.Filter) (res []*entities.User, count int64, err error) | ||
DeleteAuth(ctx context.Context, id entity.ID) error | ||
Log(ctx context.Context) *zap.SugaredLogger | ||
} | ||
|
||
type AuthRepo struct { | ||
} | ||
|
||
func (m *AuthRepo) DB(ctx context.Context) *gorm.DB { | ||
func (a *AuthRepo) DB(ctx context.Context) *gorm.DB { | ||
return global.DBFromContext(ctx).Model(&entities.Auth{}) | ||
} | ||
|
||
func (m AuthRepo) CreateAuth(ctx context.Context, Auth *entities.Auth) error { | ||
func (a AuthRepo) CreateAuth(ctx context.Context, auth *entities.Auth) error { | ||
panic("todo") | ||
} | ||
|
||
func (m AuthRepo) UpdateAuth(ctx context.Context, updateFields []string, Auth *entities.Auth) error { | ||
func (a AuthRepo) UpdateAuth(ctx context.Context, updateFields []string, auth *entities.Auth) error { | ||
panic("todo") | ||
} | ||
|
||
func (m AuthRepo) GetAuth(ctx context.Context, id entity.ID) (*entities.Auth, error) { | ||
func (a AuthRepo) GetAuth(ctx context.Context, id entity.ID) (*entities.Auth, error) { | ||
panic("todo") | ||
} | ||
|
||
func (m AuthRepo) DeleteAuth(ctx context.Context, id entity.ID) error { | ||
func (a AuthRepo) DeleteAuth(ctx context.Context, id entity.ID) error { | ||
panic("todo") | ||
} | ||
|
||
func (m AuthRepo) GetAuths(ctx context.Context, filter *database.Filter) (res []*entities.Auth, count int64, err error) { | ||
func (a AuthRepo) GetAuths(ctx context.Context, filter *database.Filter) (res []*entities.Auth, count int64, err error) { | ||
panic("todo") | ||
} | ||
|
||
func (a AuthRepo) Log(ctx context.Context) *zap.SugaredLogger { | ||
return global.Logger(ctx).Named("AuthRepo") | ||
} |
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
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
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
Binary file not shown.
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
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