Meexa
Meexa
Explore posts from servers
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
{ filepath: filepath ?? '/' } seems to work. http://localhost:3000/api/folders//? Not sure how to get rid of the ? though
7 replies
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
Hey, I've had some time to look into this and I have this endpoint now .get('/:filepath{.+}?', ...) Then I can execute this function like so
function getFolders(filepath?: string) {
return api.folders[':filepath{.+}?'].$get({ param: { filepath } })
}
function getFolders(filepath?: string) {
return api.folders[':filepath{.+}?'].$get({ param: { filepath } })
}
The problem I have now is since filepath is optional, the filepath can be undefined. What happens then is that This request is made http://localhost:3000/api/folders/undefined? If I do this { filepath: filepath ?? '' } then the request is http://localhost:3000/api/folders/? Both requests fail. What am I doing wrong?
7 replies
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
Thanks 🙏
7 replies
HHono
Created by Meexa on 6/20/2024 in #help
How to do filepath as a param in an RPC route?
@Nico Is that the correct link? Where do I look for the example?
7 replies
DTDrizzle Team
Created by Meexa on 1/9/2024 in #help
Error: Cannot open database because the directory does not exist
Updated my setup and now it works.
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
schema: './src/db/schema.ts',
driver: 'better-sqlite',
dbCredentials: {
url: './sqlite.db',
},
verbose: true,
strict: true,
out: 'drizzle',
});
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
schema: './src/db/schema.ts',
driver: 'better-sqlite',
dbCredentials: {
url: './sqlite.db',
},
verbose: true,
strict: true,
out: 'drizzle',
});
import { createClient } from '@libsql/client';
import { drizzle } from 'drizzle-orm/libsql';
import { migrate } from 'drizzle-orm/libsql/migrator';

import * as schema from './schema';

export const db = drizzle(createClient({ url: 'file:./sqlite.db' }), { schema });

migrate(db, { migrationsFolder: 'drizzle' });
import { createClient } from '@libsql/client';
import { drizzle } from 'drizzle-orm/libsql';
import { migrate } from 'drizzle-orm/libsql/migrator';

import * as schema from './schema';

export const db = drizzle(createClient({ url: 'file:./sqlite.db' }), { schema });

migrate(db, { migrationsFolder: 'drizzle' });
4 replies
DTDrizzle Team
Created by Meexa on 1/9/2024 in #help
Error: Cannot open database because the directory does not exist
I've also tried file:./sqlite.db
4 replies
DTDrizzle Team
Created by Meexa on 12/7/2023 in #help
How to do "onConflictDoUpdate" when inserting an array of values?
Got it! I think it's working. Thanks a lot!
16 replies
DTDrizzle Team
Created by Meexa on 12/7/2023 in #help
How to do "onConflictDoUpdate" when inserting an array of values?
Nice, thanks, will try this
16 replies
DTDrizzle Team
Created by Meexa on 12/7/2023 in #help
How to do "onConflictDoUpdate" when inserting an array of values?
Ah yeah, "excluded" is something that copilot suggested but it added sql.excluded which wasnt a thing
16 replies
DTDrizzle Team
Created by Meexa on 12/7/2023 in #help
How to do "onConflictDoUpdate" when inserting an array of values?
These are multiple ~2000 row inserts, so I don't think I want to wrap the map around the insert, that would be 10k+ insert queries
16 replies
DTDrizzle Team
Created by Meexa on 11/21/2023 in #help
sqlite insert results in error: "SQLite error: no such table: main.__old_push_items"
I continue to get this error, but one way to solve it is by deleting all the tables and pushing again. Not great, but its the only solution I've found so far.
7 replies
DTDrizzle Team
Created by Meexa on 11/21/2023 in #help
sqlite insert results in error: "SQLite error: no such table: main.__old_push_items"
I have pushed all changes
7 replies
DTDrizzle Team
Created by Meexa on 11/21/2023 in #help
sqlite insert results in error: "SQLite error: no such table: main.__old_push_items"
Also happens with a local sqlite db
7 replies
DTDrizzle Team
Created by Meexa on 11/21/2023 in #help
sqlite insert results in error: "SQLite error: no such table: main.__old_push_items"
7 replies
DTDrizzle Team
Created by Meexa on 8/16/2023 in #help
SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None"
I had to remove .all() because getSQL doesn't exist on that
8 replies
DTDrizzle Team
Created by Meexa on 8/16/2023 in #help
SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None"
code
const notExistingCharsInDb = await db
.select({ id: characters.id })
.from(characters)
.where(
notExists(
db
.select({ id: characters.id })
.from(characters)
.where(inArray(characters.id, memberIds)),
),
)
.getSQL();
console.log(notExistingCharsInDb);
const notExistingCharsInDb = await db
.select({ id: characters.id })
.from(characters)
.where(
notExists(
db
.select({ id: characters.id })
.from(characters)
.where(inArray(characters.id, memberIds)),
),
)
.getSQL();
console.log(notExistingCharsInDb);
8 replies
DTDrizzle Team
Created by Meexa on 8/16/2023 in #help
SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None"
Hmm it gives me this when I console log
SQL {
decoder: { mapFromDriverValue: [Function: mapFromDriverValue] },
shouldInlineParams: false,
queryChunks: [
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
SQL {
decoder: [Object],
shouldInlineParams: false,
queryChunks: [Array]
},
StringChunk { value: [Array] },
SQLiteTable {
id: [SQLiteInteger],
name: [SQLiteText],
normalized_name: [SQLiteText],
realm: [SQLiteInteger],
region: [SQLiteText],
class: [SQLiteInteger],
faction: [SQLiteInteger],
visited: [SQLiteInteger],
[Symbol(drizzle:IsAlias)]: false,
[Symbol(drizzle:ExtraConfigBuilder)]: [Function (anonymous)],
[Symbol(drizzle:IsDrizzleTable)]: true,
[Symbol(drizzle:OriginalName)]: 'characters',
[Symbol(drizzle:Name)]: 'characters',
[Symbol(drizzle:Schema)]: undefined,
[Symbol(drizzle:BaseName)]: 'characters',
[Symbol(drizzle:SQLiteInlineForeignKeys)]: [],
[Symbol(drizzle:Columns)]: [Object]
},
StringChunk { value: [Array] },
SQL {
decoder: [Object],
shouldInlineParams: false,
queryChunks: []
},
StringChunk { value: [Array] },
SQL {
decoder: [Object],
shouldInlineParams: false,
queryChunks: [Array]
},
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] }
]
}
SQL {
decoder: { mapFromDriverValue: [Function: mapFromDriverValue] },
shouldInlineParams: false,
queryChunks: [
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
SQL {
decoder: [Object],
shouldInlineParams: false,
queryChunks: [Array]
},
StringChunk { value: [Array] },
SQLiteTable {
id: [SQLiteInteger],
name: [SQLiteText],
normalized_name: [SQLiteText],
realm: [SQLiteInteger],
region: [SQLiteText],
class: [SQLiteInteger],
faction: [SQLiteInteger],
visited: [SQLiteInteger],
[Symbol(drizzle:IsAlias)]: false,
[Symbol(drizzle:ExtraConfigBuilder)]: [Function (anonymous)],
[Symbol(drizzle:IsDrizzleTable)]: true,
[Symbol(drizzle:OriginalName)]: 'characters',
[Symbol(drizzle:Name)]: 'characters',
[Symbol(drizzle:Schema)]: undefined,
[Symbol(drizzle:BaseName)]: 'characters',
[Symbol(drizzle:SQLiteInlineForeignKeys)]: [],
[Symbol(drizzle:Columns)]: [Object]
},
StringChunk { value: [Array] },
SQL {
decoder: [Object],
shouldInlineParams: false,
queryChunks: []
},
StringChunk { value: [Array] },
SQL {
decoder: [Object],
shouldInlineParams: false,
queryChunks: [Array]
},
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] },
undefined,
StringChunk { value: [Array] }
]
}
8 replies
DTDrizzle Team
Created by Meexa on 8/16/2023 in #help
SQL_PARSE_ERROR: SQL string could not be parsed: near LP, "None"
Latest (28.3)
8 replies
DTDrizzle Team
Created by Meexa on 8/18/2023 in #help
Update column A with the value of column B
ø -> o for example
6 replies
DTDrizzle Team
Created by Meexa on 8/18/2023 in #help
Update column A with the value of column B
Don't think so. It removes accented characters from names
6 replies