Skip to content

Commit 432c807

Browse files
authored
Initial tables implementation (#75)
* some experimental table typing * dark magic * added default type for table * made InferTableSchema more flexible * moved table.ts into its own folder (mirrors collections) * more type errors * broke up table.ts file in to its proper structure * more work on tavles idk * start work on common command impls class * fixed couple rebasing errors * moved all collection functions to generic internal CommandsImpls object * fixed all of the bugs I introduced in the previous commit :) * more implmeennation work * added table methods for db as well * added types (but not impl) for alterTable * add countRows * add more missing table functions * added various datatypes (dates & ip addrs) * update build report * update build report * some datatype tweaks (mostly for InetAddress) * some type operations when translating cql types
1 parent fc26224 commit 432c807

File tree

128 files changed

+3821
-1974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3821
-1974
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Try the following code after setting the following environment variables:
2727
```typescript
2828
import { DataAPIClient, VectorDoc, UUID, ObjectId } from '@datastax/astra-db-ts';
2929

30-
// Schema for the collection (VectorDoc adds the $vector field)
30+
// Schema for the collections (VectorDoc adds the $vector field)
3131
interface Idea extends VectorDoc {
3232
idea: string,
3333
}
@@ -38,7 +38,7 @@ const db = client.db('*ENDPOINT*', { namespace: '*NAMESPACE*' });
3838

3939
(async () => {
4040
try {
41-
// Creates collection, or gets it if it already exists with same options
41+
// Creates collections, or gets it if it already exists with same options
4242
const collection = await db.createCollection<Idea>('vector_5_collection', {
4343
vector: {
4444
dimension: 5,
@@ -47,7 +47,7 @@ const db = client.db('*ENDPOINT*', { namespace: '*NAMESPACE*' });
4747
checkExists: false,
4848
});
4949

50-
// Insert many ideas into the collection
50+
// Insert many ideas into the collections
5151
const ideas = [
5252
{
5353
idea: 'An AI quilt to help you sleep forever',
@@ -65,7 +65,7 @@ const db = client.db('*ENDPOINT*', { namespace: '*NAMESPACE*' });
6565
];
6666
await collection.insertMany(ideas);
6767

68-
// Insert a specific idea into the collection
68+
// Insert a specific idea into the collections
6969
const sneakersIdea = {
7070
_id: new ObjectId('507f191e810c19729de860ea'),
7171
idea: 'ChatGPT-integrated sneakers that talk to you',
@@ -202,7 +202,7 @@ Document fields stored using the `{ $date: number }` will also be returned as Da
202202
```typescript
203203
import { DataAPIClient } from '@datastax/astra-db-ts';
204204

205-
// Reference an untyped collection
205+
// Reference an untyped collections
206206
const client = new DataAPIClient('*TOKEN*');
207207
const db = client.db('*ENDPOINT*', { namespace: '*NAMESPACE*' });
208208

@@ -253,7 +253,7 @@ const client = new DataAPIClient('*TOKEN*');
253253
const db = client.db('*ENDPOINT*', { namespace: '*NAMESPACE*' });
254254

255255
(async () => {
256-
// Create a collection with a UUIDv7 as the default ID
256+
// Create a collections with a UUIDv7 as the default ID
257257
const collection = await db.createCollection<Person>('ids_test', { defaultId: { type: 'uuidv7' } });
258258

259259
// You can manually set whatever ID you want

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import js from '@eslint/js';
55
import ts from 'typescript-eslint';
66

77
export default ts.config(
8+
{
9+
ignores: ['dist/**/*', 'examples/**/*'],
10+
},
811
js.configs.recommended,
912
...ts.configs.recommended,
1013
{

0 commit comments

Comments
 (0)