Created 'constants' package for const.go file and 'types' package for shared and exported types

This commit is contained in:
Kelvin Mwinuka
2024-04-01 18:32:01 +08:00
parent 4010306dee
commit d7c3509533
43 changed files with 2927 additions and 2913 deletions

View File

@@ -20,7 +20,8 @@ import (
"cmp"
"errors"
"fmt"
"github.com/echovault/echovault/pkg/utils"
"github.com/echovault/echovault/pkg/constants"
"github.com/echovault/echovault/pkg/types"
"io"
"log"
"math/big"
@@ -128,7 +129,7 @@ func GetIPAddress() (string, error) {
return localAddr, nil
}
func GetSubCommand(command utils.Command, cmd []string) interface{} {
func GetSubCommand(command types.Command, cmd []string) interface{} {
if len(command.SubCommands) == 0 || len(cmd) < 2 {
return nil
}
@@ -140,8 +141,8 @@ func GetSubCommand(command utils.Command, cmd []string) interface{} {
return nil
}
func IsWriteCommand(command utils.Command, subCommand utils.SubCommand) bool {
return slices.Contains(append(command.Categories, subCommand.Categories...), utils.WriteCategory)
func IsWriteCommand(command types.Command, subCommand types.SubCommand) bool {
return slices.Contains(append(command.Categories, subCommand.Categories...), constants.WriteCategory)
}
func AbsInt(n int) int {