Can now convert csv to proto + open proto file + filter

This commit is contained in:
cdricms
2024-04-29 21:24:13 +02:00
parent 691c063590
commit 6c5c1d594c
11 changed files with 374 additions and 79 deletions

View File

@@ -6,6 +6,15 @@ import (
// "git.cems.dev/cdricms/bdooc/parsing"
)
func SaveToFile(data []uint8, filename string) error {
EmployeeList := &EmployeeList{}
err := proto.Unmarshal(data, EmployeeList)
if err != nil {
return err
}
return EmployeeList.SaveToFile(filename)
}
func (el *EmployeeList) SaveToFile(filename string) error {
data, err := proto.Marshal(el)
if err != nil {

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"math"
"reflect"
"strings"
)
func GetMax[T float64 | float32 | int | uint | int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64](a, b T) T {
@@ -62,6 +63,15 @@ const (
FieldPassword = "Password"
)
func SnakeCaseToPascalCase(s string) string {
words := strings.Split(s, "_")
for i, word := range words {
words[i] = strings.ToUpper(word[0:1]) + strings.ToLower(word[1:])
}
return strings.Join(words, "")
}
func (e *Employee) Copy() Employee {
return Employee{
EmpId: e.GetEmpId(),