MCPcopy Index your code
hub / github.com/outerbase/studio / parseColumnDef

Function parseColumnDef

src/drivers/sqlite/sql-parse-table.ts:154–178  ·  view source on GitHub ↗
(
  schemaName: string,
  cursor: CursorV2
)

Source from the content-addressed store, hash-verified

152}
153
154function parseColumnDef(
155 schemaName: string,
156 cursor: CursorV2
157): DatabaseTableColumn | null {
158 const columnName = cursor.consumeIdentifier();
159 if (!columnName) return null;
160
161 let dataType = cursor.read();
162 cursor.next();
163
164 // Handle case such as VARCHAR(255) where we need to read
165 // something inside the parens
166 if (cursor.match("(")) {
167 dataType += cursor.consumeParen().toStringWithParen();
168 }
169
170 const constraint = parseColumnConstraint(schemaName, cursor);
171
172 return {
173 name: columnName,
174 pk: constraint?.primaryKey,
175 constraint,
176 type: dataType,
177 };
178}
179
180function parseConstraintConflict(
181 cursor: CursorV2

Callers 1

parseTableDefinitionFunction · 0.85

Calls 7

parseColumnConstraintFunction · 0.85
consumeIdentifierMethod · 0.80
readMethod · 0.80
nextMethod · 0.80
toStringWithParenMethod · 0.80
consumeParenMethod · 0.80
matchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…