Skip to content
2 changes: 1 addition & 1 deletion auth/access/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ func NewDenyResponse(message string) access.Response {
}

type ResponseImpl struct {
allowed bool
message string
allowed bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the sort rule to the PR description?

}

func (r *ResponseImpl) Allowed() bool {
Expand Down
2 changes: 1 addition & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type Auth struct {
contractsauth.GuardDriver
config config.Config
ctx http.Context
defaultGuardName string
log log.Log
defaultGuardName string
}

func NewAuth(ctx http.Context, config config.Config, log log.Log) (*Auth, error) {
Expand Down
8 changes: 4 additions & 4 deletions auth/jwt_guard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (s *JwtGuardTestSuite) TestUser_Success() {
s.Nil(err)

var user User
s.mockUserProvider.EXPECT().RetriveByID(&user, "1").RunAndReturn(func(user interface{}, id interface{}) error {
s.mockUserProvider.EXPECT().RetriveByID(&user, "1").RunAndReturn(func(user any, id any) error {
user.(*User).ID = 1
return nil
}).Once()
Expand Down Expand Up @@ -367,7 +367,7 @@ func (s *JwtGuardTestSuite) TestUser_Success_MultipleParse() {
s.Equal("2", payload.Key)

var user1 User
s.mockUserProvider.EXPECT().RetriveByID(&user1, "1").RunAndReturn(func(user interface{}, id interface{}) error {
s.mockUserProvider.EXPECT().RetriveByID(&user1, "1").RunAndReturn(func(user any, id any) error {
user.(*User).ID = 1
return nil
}).Once()
Expand All @@ -377,7 +377,7 @@ func (s *JwtGuardTestSuite) TestUser_Success_MultipleParse() {
s.Equal(uint(1), user1.ID)

var user2 User
s.mockUserProvider.EXPECT().RetriveByID(&user2, "2").RunAndReturn(func(user interface{}, id interface{}) error {
s.mockUserProvider.EXPECT().RetriveByID(&user2, "2").RunAndReturn(func(user any, id any) error {
user.(*User).ID = 2
return nil
}).Once()
Expand Down Expand Up @@ -504,7 +504,7 @@ func (r *Context) Err() error {
return r.ctx.Err()
}

func (r *Context) Value(key interface{}) any {
func (r *Context) Value(key any) any {
if k, ok := key.(string); ok {
r.mu.RLock()
v, ok := r.values[k]
Expand Down
2 changes: 1 addition & 1 deletion auth/session_guard.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
type SessionGuard struct {
session contractsession.Session
ctx http.Context
guard string
provider contractsauth.UserProvider
guard string
}

func NewSessionGuard(ctx http.Context, name string, userProvider contractsauth.UserProvider) (contractsauth.GuardDriver, error) {
Expand Down
2 changes: 1 addition & 1 deletion cache/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

type Lock struct {
store contractscache.Driver
key string
time *time.Duration
key string
get bool
}

Expand Down
4 changes: 2 additions & 2 deletions cache/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *MemoryTestSuite) TestDecrementWithConcurrent() {
s.Nil(err)

var wg sync.WaitGroup
for i := 0; i < 1000; i++ {
for range 1000 {
wg.Add(1)
go func() {
_, err = s.memory.Decrement("decrement_concurrent", 1)
Expand Down Expand Up @@ -180,7 +180,7 @@ func (s *MemoryTestSuite) TestIncrementWithConcurrent() {
s.Nil(err)

var wg sync.WaitGroup
for i := 0; i < 1000; i++ {
for range 1000 {
wg.Add(1)
go func() {
_, err = s.memory.Increment("increment_concurrent", 1)
Expand Down
9 changes: 3 additions & 6 deletions console/cli_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,9 @@ func lexicographicLess(i, j string) bool {
iRunes := []rune(i)
jRunes := []rune(j)

lenShared := len(iRunes)
if lenShared > len(jRunes) {
lenShared = len(jRunes)
}
lenShared := min(len(iRunes), len(jRunes))

for index := 0; index < lenShared; index++ {
for index := range lenShared {
ir := iRunes[index]
jr := jRunes[index]

Expand Down Expand Up @@ -297,7 +294,7 @@ func onUsageError(_ context.Context, _ *cli.Command, err error, _ bool) error {
return err
}

func printHelpCustom(out io.Writer, templ string, data interface{}, _ map[string]interface{}) {
func printHelpCustom(out io.Writer, templ string, data any, _ map[string]any) {
funcMap := template.FuncMap{
"capitalize": capitalize,
"colorize": colorize,
Expand Down
4 changes: 2 additions & 2 deletions contracts/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ type UserProvider interface {
}

type Payload struct {
Guard string
Key string
ExpireAt time.Time
IssuedAt time.Time
Guard string
Key string
}

type GuardFunc func(ctx http.Context, name string, userProvider UserProvider) (GuardDriver, error)
Expand Down
44 changes: 22 additions & 22 deletions contracts/console/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,75 +92,75 @@ type Progress interface {
type Choice struct {
// Key the choice key.
Key string
// Selected determines if the choice is selected.
Selected bool
// Value the choice value.
Value string
// Selected determines if the choice is selected.
Selected bool
}

type AskOption struct {
// Validate the input validation function.
Validate func(string) error
// Default the default value for the input.
Default string
// Description the input description.
Description string
// Placeholder the input placeholder.
Placeholder string
// Prompt the prompt message.(use for single line input)
Prompt string
// Lines the number of lines for the input.(use for multiple lines text)
Lines int
// Limit the character limit for the input.
Limit int
// Multiple determines if input is single line or multiple lines text
Multiple bool
// Placeholder the input placeholder.
Placeholder string
// Prompt the prompt message.(use for single line input)
Prompt string
// Validate the input validation function.
Validate func(string) error
}

type ChoiceOption struct {
// Validate the input validation function.
Validate func(string) error
// Default the default value for the input.
Default string
// Description the input description.
Description string
// Validate the input validation function.
Validate func(string) error
}

type ConfirmOption struct {
// Affirmative label for the affirmative button.
Affirmative string
// Default the default value for the input.
Default bool
// Description the input description.
Description string
// Negative label for the negative button.
Negative string
// Default the default value for the input.
Default bool
}

type SecretOption struct {
// Validate the input validation function.
Validate func(string) error
// Default the default value for the input.
Default string
// Description the input description.
Description string
// Limit the character limit for the input.
Limit int
// Placeholder the input placeholder.
Placeholder string
// Validate the input validation function.
Validate func(string) error
// Limit the character limit for the input.
Limit int
}

type MultiSelectOption struct {
// Default the default value for the input.
Default []string
// Validate the input validation function.
Validate func([]string) error
// Description the input description.
Description string
// Filterable determines if the choices can be filtered.
Filterable bool
// Default the default value for the input.
Default []string
// Limit the number of choices that can be selected.
Limit int
// Validate the input validation function.
Validate func([]string) error
// Filterable determines if the choices can be filtered.
Filterable bool
}

type SpinnerOption struct {
Expand Down
34 changes: 17 additions & 17 deletions contracts/console/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ type Flag interface {

type BoolFlag struct {
Name string
Usage string
Aliases []string
DisableDefaultText bool
Usage string
Required bool
Value bool
}
Expand All @@ -38,10 +38,10 @@ func (receiver *BoolFlag) Type() string {

type Float64Flag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value float64
Required bool
}

func (receiver *Float64Flag) Type() string {
Expand All @@ -50,10 +50,10 @@ func (receiver *Float64Flag) Type() string {

type Float64SliceFlag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value []float64
Required bool
}

func (receiver *Float64SliceFlag) Type() string {
Expand All @@ -62,10 +62,10 @@ func (receiver *Float64SliceFlag) Type() string {

type IntFlag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value int
Required bool
}

func (receiver *IntFlag) Type() string {
Expand All @@ -74,10 +74,10 @@ func (receiver *IntFlag) Type() string {

type IntSliceFlag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value []int
Required bool
}

func (receiver *IntSliceFlag) Type() string {
Expand All @@ -86,10 +86,10 @@ func (receiver *IntSliceFlag) Type() string {

type Int64Flag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value int64
Required bool
}

func (receiver *Int64Flag) Type() string {
Expand All @@ -98,10 +98,10 @@ func (receiver *Int64Flag) Type() string {

type Int64SliceFlag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value []int64
Required bool
}

func (receiver *Int64SliceFlag) Type() string {
Expand All @@ -110,10 +110,10 @@ func (receiver *Int64SliceFlag) Type() string {

type StringFlag struct {
Name string
Aliases []string
Usage string
Required bool
Value string
Aliases []string
Required bool
}

func (receiver *StringFlag) Type() string {
Expand All @@ -122,10 +122,10 @@ func (receiver *StringFlag) Type() string {

type StringSliceFlag struct {
Name string
Aliases []string
Usage string
Required bool
Aliases []string
Value []string
Required bool
}

func (receiver *StringSliceFlag) Type() string {
Expand Down
10 changes: 5 additions & 5 deletions contracts/database/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ type Pool struct {
}

type Config struct {
Dialector gorm.Dialector
NameReplacer Replacer
Charset string
Connection string
Dsn string
Database string
Dialector gorm.Dialector
Driver string
Host string
NameReplacer Replacer
NoLowerCase bool
Password string
Port int
Prefix string
Schema string
Singular bool
Sslmode string
Timezone string
Username string
Port int
NoLowerCase bool
Singular bool
}

// Replacer replacer interface like strings.Replacer
Expand Down
4 changes: 2 additions & 2 deletions contracts/database/driver/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ type ColumnDefinition interface {
}

type Column struct {
Autoincrement bool
Collation string
Comment string
Default string
Extra string
Name string
Nullable bool
Type string
TypeName string
Autoincrement bool
Nullable bool
}
2 changes: 1 addition & 1 deletion contracts/database/driver/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ type Join struct {
}

type Where struct {
Type WhereType
Query any
Args []any
Type WhereType
Or bool
IsNot bool
}
Loading