MCPcopy
hub / github.com/eveningkid/denodb / _findPrimaryField

Method _findPrimaryField

lib/model.ts:178–188  ·  view source on GitHub ↗

Manually find the primary field by going through the schema fields.

()

Source from the content-addressed store, hash-verified

176
177 /** Manually find the primary field by going through the schema fields. */
178 private static _findPrimaryField(): FieldOptions {
179 const field = Object.entries(this.fields).find(
180 ([_, fieldType]) => typeof fieldType === "object" && fieldType.primaryKey,
181 );
182
183 return {
184 name: field ? (this.formatFieldToDatabase(field[0]) as string) : "",
185 type: field ? field[1] : DataTypes.INTEGER,
186 defaultValue: 0,
187 };
188 }
189
190 /** Manually find the primary key by going through the schema fields. */
191 private static _findPrimaryKey(): string {

Callers 3

_findPrimaryKeyMethod · 0.95

Calls 2

formatFieldToDatabaseMethod · 0.95
findMethod · 0.45

Tested by

no test coverage detected