diff --git a/core/errs/err_group.go b/core/errs/err_group.go index 0fe9d3a..99575ba 100644 --- a/core/errs/err_group.go +++ b/core/errs/err_group.go @@ -33,7 +33,7 @@ import ( -type ErrGroup ErrList +type ErrGroup Errs diff --git a/core/errs/err_list.go b/core/errs/err_list.go index b86815a..e583dbf 100644 --- a/core/errs/err_list.go +++ b/core/errs/err_list.go @@ -25,11 +25,11 @@ package errs -type ErrList []error +type Errs []error -func (l ErrList) Clean() ErrList { +func (l Errs) Clean() Errs { for _, e := range l { if e == nil { return l.clean() @@ -39,7 +39,7 @@ func (l ErrList) Clean() ErrList { } -func (l ErrList) clean() ErrList { +func (l Errs) clean() Errs { rs := make([]error, 0, len(l)) for _, e := range l { if e != nil { @@ -50,7 +50,7 @@ func (l ErrList) clean() ErrList { } -func (l ErrList) GetFirst() error { +func (l Errs) GetFirst() error { for _, er := range l { if er != nil { return er @@ -60,7 +60,7 @@ func (l ErrList) GetFirst() error { } -func (l ErrList) GetLast() error { +func (l Errs) GetLast() error { for i := len(l) - 1; i >= 0; i-- { if l[i] != nil { return l[i] @@ -70,15 +70,15 @@ func (l ErrList) GetLast() error { } -func (l ErrList) Any() bool { +func (l Errs) Any() bool { return l.count(true) > 0 } -func (l ErrList) Count() int { +func (l Errs) Count() int { return _errorsCount(false, l) } -func (l ErrList) count(ext bool) int { +func (l Errs) count(ext bool) int { rs := 0 for _, er := range l { if er != nil { @@ -92,7 +92,7 @@ func (l ErrList) count(ext bool) int { } -func (l ErrList) Stack() StackTrace { +func (l Errs) Stack() StackTrace { for _, er := range l { if er != nil { st := getStackTrace(er) @@ -105,7 +105,7 @@ func (l ErrList) Stack() StackTrace { } -func (l ErrList) ToError() error { +func (l Errs) ToError() error { switch _errorsCount(false, l) { case 0: return nil diff --git a/core/errs/gogo.go b/core/errs/gogo.go index aec78ab..4df157c 100644 --- a/core/errs/gogo.go +++ b/core/errs/gogo.go @@ -72,7 +72,7 @@ func ToError(err any) error { case error: return e case []error: - return ErrList(e).ToError() + return Errs(e).ToError() default: return ErrCode(fmt.Sprintf("#{er}")) } diff --git a/core/slices/string.go b/core/slices/string.go index 08a182f..5c849cc 100644 --- a/core/slices/string.go +++ b/core/slices/string.go @@ -25,23 +25,23 @@ package slices -type String []string +type Strings []string -func MakeString(size, capacity int) String { - return make(String, size, capacity) +func MakeStrings(size, capacity int) Strings { + return make(Strings, size, capacity) } -func (s String) Reset() String { +func (s Strings) Reset() Strings { if s != nil { return s[:0] } return s } -func (s String) Has(value string) bool { +func (s Strings) Has(value string) bool { if len(s) == 0 { return false } @@ -53,6 +53,6 @@ func (s String) Has(value string) bool { return false } -func (s String) Append(value string) String { +func (s Strings) Append(value string) Strings { return append(s, value) } diff --git a/core/values/field.go b/core/values/field.go index 1fec454..1f54934 100644 --- a/core/values/field.go +++ b/core/values/field.go @@ -24,7 +24,6 @@ package values - type ( Field interface { @@ -36,6 +35,9 @@ type ( func NewField (name string, value any) (Field,error) { - switch value.(type) { + switch v := value.(type) { + case string: return NewFieldString(name,v),nil + default: + return nil,nil } } \ No newline at end of file diff --git a/core/values/field_int8.go b/core/values/field_int8.go new file mode 100644 index 0000000..7137cbd --- /dev/null +++ b/core/values/field_int8.go @@ -0,0 +1,26 @@ +// ------------------------------------------------------------------------ +// Project atila +// Active Thing (activething.com) git.activething.com/go +// +// File name field_int8.go +// Created by DEV +// Modified 03/03/2024 +// +// Copyright 2024 activething.com +// ------------------------------------------------------------------------ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ------------------------------------------------------------------------ + +package values + + diff --git a/core/values/field_string.go b/core/values/field_string.go index 0dd787b..2961a60 100644 --- a/core/values/field_string.go +++ b/core/values/field_string.go @@ -45,12 +45,24 @@ func NewFieldString (name string, value string) *FieldString { } } + func (f FieldString) Name () string { return f.n } -func (f FieldString) Value() string { +func (f FieldString) Value() any { return f.v } func (_ FieldString) FieldType () FieldType { + return FieldTypeString } + +func (f FieldString) String() string { + return f.v } + + + + + + + + -} diff --git a/core/values/valueSetter.go b/core/values/value_setter.go similarity index 100% rename from core/values/valueSetter.go rename to core/values/value_setter.go diff --git a/logs/entry.go b/logs/entry.go index 3dab3b9..03a039c 100644 --- a/logs/entry.go +++ b/logs/entry.go @@ -49,7 +49,7 @@ type ( Data any - excludes slices.String + excludes slices.Strings }