You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.5 KiB
74 lines
1.5 KiB
package main
|
|
|
|
import (
|
|
"aflds"
|
|
"fmt"
|
|
)
|
|
|
|
type (
|
|
|
|
S = struct {
|
|
A string
|
|
}
|
|
)
|
|
|
|
func Una () S {
|
|
fmt.Println("Es llamado ")
|
|
return S { A : "Un valiue" }
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
/*
|
|
|
|
fields := aflds.Fields{
|
|
aflds.NewFieldString("name1","ss"),
|
|
aflds.NewFieldString("name2","sd"),
|
|
aflds.NewFieldString("name3","sd"),
|
|
aflds.NewFieldString("name1","sd"),
|
|
aflds.NewFieldString("name4","sd"),
|
|
aflds.NewFieldString("name1","sd"),
|
|
}
|
|
|
|
|
|
// Eliminamos todos los campos con el nombre "name1"
|
|
updatedFields := fields.DelAll("name1")
|
|
|
|
// Comprobamos si los campos con el nombre "name1" se han eliminado correctamente
|
|
for _, field := range updatedFields {
|
|
if field.Name() == "name1" {
|
|
fmt.Println("Error: Se encontró un campo con el nombre 'name1'")
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
i := aflds.NewField("UnUnt",int16(15))
|
|
fmt.Printf("%s\n",i.Kind().KindNames())
|
|
|
|
v := func() int16 { return 32 }
|
|
|
|
cc,ok := aflds.g.constructors[reflect.TypeOf(v)]
|
|
if !ok {
|
|
fmt.Println("No hay constructor")
|
|
return
|
|
}
|
|
cf := cc("namefuied",v)
|
|
|
|
v1,_ := cf.Int()
|
|
fmt.Printf("%s = %v\n",i.Kind().KindNames(), v1)
|
|
|
|
*/
|
|
aflds.Create("f1", "value",aflds.KindString)
|
|
aflds.Create("f2", uint(11),aflds.KindUint)
|
|
aflds.Create("f3", -11,aflds.KindInt)
|
|
aflds.Create("f4", 2.3,aflds.KindFloat)
|
|
aflds.Create("f5", []byte{1,2,2,4,3,3,3,3},aflds.KindBinary)
|
|
aflds.Create("d1",func()int{ return -3 },aflds.KindDeferInt)
|
|
aflds.Create("d2",func()uint{ return uint(3) },aflds.KindDeferUint)
|
|
aflds.Create("f2",func()float64{ return 3.2},aflds.KindDeferFloat)
|
|
|
|
|
|
}
|