MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / assignValues

Method assignValues

ent/gitcommit.go:85–162  ·  view source on GitHub ↗

assignValues assigns the values that were returned from sql.Rows (after scanning) to the GitCommit fields.

(columns []string, values []any)

Source from the content-addressed store, hash-verified

83// assignValues assigns the values that were returned from sql.Rows (after scanning)
84// to the GitCommit fields.
85func (gc *GitCommit) assignValues(columns []string, values []any) error {
86 if m, n := len(values), len(columns); m < n {
87 return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
88 }
89 for i := range columns {
90 switch columns[i] {
91 case gitcommit.FieldID:
92 if value, ok := values[i].(*uuid.UUID); !ok {
93 return fmt.Errorf("unexpected type %T for field id", values[i])
94 } else if value != nil {
95 gc.ID = *value
96 }
97 case gitcommit.FieldCreateTime:
98 if value, ok := values[i].(*sql.NullTime); !ok {
99 return fmt.Errorf("unexpected type %T for field create_time", values[i])
100 } else if value.Valid {
101 gc.CreateTime = value.Time
102 }
103 case gitcommit.FieldUpdateTime:
104 if value, ok := values[i].(*sql.NullTime); !ok {
105 return fmt.Errorf("unexpected type %T for field update_time", values[i])
106 } else if value.Valid {
107 gc.UpdateTime = value.Time
108 }
109 case gitcommit.FieldCommitHash:
110 if value, ok := values[i].(*sql.NullString); !ok {
111 return fmt.Errorf("unexpected type %T for field commit_hash", values[i])
112 } else if value.Valid {
113 gc.CommitHash = value.String
114 }
115 case gitcommit.FieldBranchName:
116 if value, ok := values[i].(*sql.NullString); !ok {
117 return fmt.Errorf("unexpected type %T for field branch_name", values[i])
118 } else if value.Valid {
119 gc.BranchName = value.String
120 }
121 case gitcommit.FieldRepoName:
122 if value, ok := values[i].(*sql.NullString); !ok {
123 return fmt.Errorf("unexpected type %T for field repo_name", values[i])
124 } else if value.Valid {
125 gc.RepoName = value.String
126 }
127 case gitcommit.FieldCommitMessage:
128 if value, ok := values[i].(*sql.NullString); !ok {
129 return fmt.Errorf("unexpected type %T for field commit_message", values[i])
130 } else if value.Valid {
131 gc.CommitMessage = value.String
132 }
133 case gitcommit.FieldCommitTimestamp:
134 if value, ok := values[i].(*sql.NullTime); !ok {
135 return fmt.Errorf("unexpected type %T for field commit_timestamp", values[i])
136 } else if value.Valid {
137 gc.CommitTimestamp = value.Time
138 }
139 case gitcommit.FieldAuthor:
140 if value, ok := values[i].(*sql.NullString); !ok {
141 return fmt.Errorf("unexpected type %T for field author", values[i])
142 } else if value.Valid {

Callers 1

sqlAllMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected