MCPcopy Index your code
hub / github.com/ent/ent / assign

Method assign

dialect/sql/sqlgraph/graph_test.go:1699–1722  ·  view source on GitHub ↗
(columns []string, values []any)

Source from the content-addressed store, hash-verified

1697}
1698
1699func (u *user) assign(columns []string, values []any) error {
1700 if len(columns) != len(values) {
1701 return fmt.Errorf("mismatch number of values")
1702 }
1703 for i, c := range columns {
1704 switch c {
1705 case "id":
1706 u.id = int(values[i].(*sql.NullInt64).Int64)
1707 case "age":
1708 u.age = int(values[i].(*sql.NullInt64).Int64)
1709 case "name":
1710 u.name = values[i].(*sql.NullString).String
1711 case "best_friend_id":
1712 u.bfID = int(values[i].(*sql.NullInt64).Int64)
1713 case "fk1":
1714 u.edges.fk1 = int(values[i].(*sql.NullInt64).Int64)
1715 case "fk2":
1716 u.edges.fk2 = int(values[i].(*sql.NullInt64).Int64)
1717 default:
1718 return fmt.Errorf("unknown column %q", c)
1719 }
1720 }
1721 return nil
1722}
1723
1724func TestUpdateNode(t *testing.T) {
1725 tests := []struct {

Callers 2

TestQueryNodesFunction · 0.80
TestQueryNodesSchemaFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected