deep-foundation / deep-foundation/deeplinks

What should I save to minilinks?

Open
#132 0 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
TypeScript
Stars
13
Forks
8
PR merge metrics
No merged PRs in 30d

Description

# Question
All of the below code samples will work (I will be able to use deep.idLocal and find specific link from package) but are there any reasons to choose one solution over another?

# Code

```ts
const devicePackageSelectData: BoolExpLink = {
type_id: {
_id: ['@deep-foundation/core', "Package"]
},
string: {
value: "@deep-foundation/device"
}
};

const containSelectData: BoolExpLink = {
type_id: {
_id: ['@deep-foundation/core', "Contain"]
},
from: devicePackageSelectData
};

const {data: [containLink]} = await deep.select(containSelectData, {returning: `
${deep.selectReturning}
from {
${deep.selectReturning}
}
to {
${deep.selectReturning}
}
`})
deep.minilinks.apply([containLink])
```
```ts
const devicePackageSelectData: BoolExpLink = {
type_id: {
_id: ['@deep-foundation/core', "Package"]
},
string: {
value: "@deep-foundation/device"
}
};

const containSelectData: BoolExpLink = {
type_id: {
_id: ['@deep-foundation/core', "Contain"]
},
from: devicePackageSelectData
};

const {data: [containLink]} = await deep.select(containSelectData, {returning: `
${deep.selectReturning}
from {
${deep.selectReturning}
}
to {
${deep.selectReturning}
}
`})
deep.minilinks.apply([containLink, containLink.from, containLink.to])
```
```ts
const devicePackageSelectData: BoolExpLink = {
type_id: {
_id: ['@deep-foundation/core', "Package"]
},
string: {
value: "@deep-foundation/device"
}
};

const containSelectData: BoolExpLink = {
type_id: {
_id: ['@deep-foundation/core', "Contain"]
},
from: devicePackageSelectData
};

const packageLinksSelectData: BoolExpLink = {
in: containSelectData
}
const {data} = await deep.select({
_or: [
devicePackageSelectData, containSelectData, packageLinksSelectData
]
})
deep.minilinks.apply(data)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.