Skip to content

Commit 70f008f

Browse files
Type-32nuxtstudio
andcommitted
feat(projects): added other projects
Co-authored-by: Nuxt Studio <noreply@nuxt.studio>
1 parent a2e36c7 commit 70f008f

File tree

5 files changed

+293
-0
lines changed

5 files changed

+293
-0
lines changed

content/projects/facet-api.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
title: Facet API
3+
description: A unified class for managing callbacks and cutting down references to MonoBehaviours.
4+
seo:
5+
title: Facet-api file
6+
description: "A unified class for managing callbacks and cutting down references to MonoBehaviours. "
7+
tags: []
8+
date: 2025-08-29
9+
progress: release
10+
repository:
11+
repoUsername: CTRL-Neo-Studios
12+
repoName: facet-api
13+
showIssues: true
14+
showWiki: true
15+
navigation:
16+
icon: i-ic-sharp-api
17+
---
18+
19+
Facet API is a simple plug-and-pull library for managing your callbacks in C# to avoid annoying external references to other classes or objects.
20+
21+
## Design
22+
23+
This API is designed for Unity and provides a unified interface for managing callbacks between classes.
24+
25+
The main idea is to have a unified interface of access between classes that has functions that needs to be called on either side. For example:
26+
27+
![mermaid-diagram-2026-01-08-204148](/projects/facet-api/mermaid-diagram-2026-01-08-204148.png)
28+
29+
As you can see from the graph, classes are accessing classes to try to access the different functions or variables within them, leading to a spaghetti of references and are sometimes hard to manage and track down.
30+
31+
With FacetAPI, you can unify all the functions and variables you need to access into callbacks:
32+
33+
![mermaid-diagram-2026-01-08-204233](/projects/facet-api/mermaid-diagram-2026-01-08-204233.png)
34+
35+
As you can see, the classes are now only accessing the FacetAPI of the other classes, which is a single point of access to all the functions and variables you need to access. This makes it easier to manage and track down references between classes. This also allows you to easily swap out implementations of the FacetAPI without having to change the references in the other classes. This is especially useful for testing, as you can easily swap out the implementation of the FacetAPI with a mock implementation for testing purposes.
36+
37+
## Usage
38+
39+
The usage itself is pretty simple, per design. Though we are using a name-based system, so you need to be careful with the names of the callbacks you create. (We have error handling for conflicting names, but it is still a good idea to be careful with the names you use.)
40+
41+
What we'd suggest for a workaround of the issue above is to have a class have all the static constant variables of the keywords of callbacks, that way when getting callbacks or creating callbacks you'd have better control over the names you use.
42+
43+
### Creating a Callback
44+
45+
```csharp
46+
using FacetAPI.Runtime.Core;
47+
48+
// Create API instance
49+
var api = new FacetApi();
50+
51+
// Create a callback
52+
var callback = api.CreateCallback<Action<string>>("testCallback");
53+
54+
// Subscribe
55+
callback.Subscribe(msg => Debug.Log($"Received: {msg}"));
56+
57+
// Invoke
58+
callback.Invoke("Hello World");
59+
60+
// Watch for condition (async version)
61+
var cts = new CancellationTokenSource();
62+
_ = callback.WatchAndInvokeAsync(
63+
"Test",
64+
() => DateTime.Now.Second % 10 == 0,
65+
TimeSpan.FromSeconds(1),
66+
cts.Token);
67+
```
68+
69+
### Getting a Callback
70+
71+
```csharp
72+
using FacetAPI.Runtime.Core;
73+
74+
// Create and register a callback
75+
var api = new FacetApi();
76+
api.CreateCallback<Action<int>>("onScoreChanged");
77+
78+
// Later, fetch it elsewhere in your code
79+
var scoreCallback = api.Get<Action<int>>("onScoreChanged");
80+
scoreCallback.Subscribe(score => Debug.Log($"Score changed to {score}"));
81+
82+
// Invoke it
83+
scoreCallback.Invoke(100);
84+
```
85+
86+
## Installation
87+
88+
### Unity Package Manager (Recommended)
89+
90+
1. Open the Unity Package Manager (Window > Package Manager)
91+
2. Click the "+" button in the top-left corner
92+
3. Select "Add package from git URL..."
93+
4. Enter the URL of this repository: `https://github.com/CTRL-Neo-Studios/facet-api.git`
94+
5. Click "Add"
95+
6. Wait for Unity to download and import the package
96+
7. Use the package in your scripts by adding `using FacetAPI.Runtime.Core;`
97+
98+
### Manual Installation
99+
100+
1. Clone this repository into your Unity project's `Packages` folder
101+
2. The package will be automatically recognized by Unity
102+
3. Use the package in your scripts by adding `using FacetAPI.Runtime.Core;`
103+
104+
## Requirements
105+
106+
- Unity 2021.3 or later
107+
- .NET Standard 2.1 compatible
108+
109+
## License
110+
111+
This project is licensed under the MIT License - see the LICENSE file for details.

content/projects/simple-cli.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: SimpleCLI
3+
description: "An extremely simple CLI building tool for CSharp projects. "
4+
seo:
5+
title: Simple-cli file
6+
description: "An extremely simple CLI building tool for CSharp projects. "
7+
date: 2025-04-15
8+
tags: []
9+
progress: release
10+
repository:
11+
repoUsername: CTRL-Neo-Studios
12+
repoName: simple-cli
13+
showIssues: true
14+
showWiki: true
15+
navigation:
16+
icon: i-lucide-code
17+
---
18+
19+
An extremely simple CLI building tool for CSharp projects.
20+
21+
## Usage
22+
23+
### Modules
24+
25+
Please check the [Modules Document](https://github.com/CTRL-Neo-Studios/simple-cli/blob/dev/Modules.md).
26+
27+
### Parsing
28+
29+
```csharp
30+
// Registering and using commands
31+
var parser = new SimpleCLIParser();
32+
parser.RegisterCommand(new MyCustomCommand());
33+
34+
// Execute commands
35+
parser.Execute("echo Hello World --color green");
36+
parser.Execute("help echo");
37+
```
38+
39+
### Custom Commands
40+
41+
You can use the `SimpleCLICommand` class to create your own commands. Here is an example of a custom echo command:
42+
43+
```csharp
44+
public class ExampleCommand : CLICommand
45+
{
46+
public override string Name => "echo";
47+
public override string Description => "Echoes the input back to the console";
48+
public override string Usage => "echo <message> [-c color]";
49+
public override string[] Aliases => new[] { "print" };
50+
51+
public override void Execute(CLIArguments args, CLIParser context)
52+
{
53+
if (args.Arguments.Count == 0)
54+
throw new CLIException("No message provided");
55+
56+
string message = string.Join(" ", args.Arguments);
57+
string color = args.GetFlag("c", "white");
58+
59+
context.Output($"<color={color}>{message}</color>");
60+
}
61+
62+
public override string[] GetAutoCompleteSuggestions(int argIndex, string input)
63+
{
64+
if (argIndex == 0)
65+
{
66+
return new[] { "red", "green", "blue", "yellow", "white" };
67+
}
68+
return base.GetAutoCompleteSuggestions(argIndex, input);
69+
}
70+
}
71+
```
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
title: Tauri SQLite ORM
3+
description: "Simple Drizzle-like ORM Wrapper on top of Tauri V2's SQLite JS API Plugin. "
4+
seo:
5+
title: Tauri-sqlite-orm file
6+
description: "Simple Drizzle-like ORM Wrapper on top of Tauri V2's SQLite JS API Plugin. "
7+
date: 2025-08-26
8+
tags: []
9+
progress: alpha
10+
repository:
11+
repoUsername: Type-32
12+
repoName: tauri-sqlite-orm
13+
showIssues: true
14+
showWiki: true
15+
---
16+
17+
A Drizzle-like TypeScript ORM tailored for Tauri v2's `@tauri-apps/plugin-sql` (SQLite). It provides a simple, type-safe query builder and migration tools to help you manage your database with ease.
18+
19+
### Features
20+
21+
- **Drizzle-like Schema:** Define your database schema using a familiar, chainable API.
22+
- **Strict Type Inference:** Full TypeScript type safety with no `any` types - nullable columns, custom types, and required/optional fields are accurately inferred.
23+
- **Type-Safe Query Builder:** Build SQL queries with TypeScript, ensuring type safety and autocompletion.
24+
- **Relations Support:** Define and query one-to-one, one-to-many, and many-to-many relationships between tables.
25+
- **Nested Includes:** Load relations of relations with intuitive nested syntax.
26+
- **Advanced Operators:** Comprehensive set of operators including `ne`, `between`, `notIn`, `ilike`, `startsWith`, `endsWith`, `contains`, and more.
27+
- **Subquery Support:** Use subqueries in WHERE and SELECT clauses with full type safety.
28+
- **Aggregate Functions:** Type-safe aggregates like `count`, `sum`, `avg`, `min`, `max`, and SQLite's `groupConcat`.
29+
- **Query Debugging:** Use `.toSQL()` on any query to inspect generated SQL and parameters.
30+
- **Safety Features:** Automatic WHERE clause validation for UPDATE/DELETE prevents accidental data loss.
31+
- **Increment/Decrement:** Atomic increment/decrement operations for safe counter updates.
32+
- **Better Error Handling:** Custom error classes for clear, actionable error messages.
33+
- **Simplified Migrations:** Keep your database schema in sync with your application's models using automatic schema detection and migration tools.
34+
- **Lightweight & Performant:** Designed to be a thin layer over the Tauri SQL plugin, ensuring minimal overhead.
35+
36+
Also, bun is the preferred package manager for developing this library, if you want to contribute.
37+
38+
### Installation
39+
40+
```bash
41+
bun add @type32/tauri-sqlite-orm @tauri-apps/plugin-sql
42+
```
43+
44+
Make sure the SQL plugin is registered on the Rust side (see Tauri docs).
45+
46+
### Quick Example
47+
48+
```js
49+
import Database from '@tauri-apps/plugin-sql'
50+
import { TauriORM, sqliteTable, int, text, relations } from '@type32/tauri-sqlite-orm'
51+
52+
// Define tables
53+
const users = sqliteTable('users', {
54+
id: int('id').primaryKey().autoincrement(),
55+
name: text('name').notNull(),
56+
email: text('email').notNull().unique(),
57+
})
58+
59+
const posts = sqliteTable('posts', {
60+
id: int('id').primaryKey().autoincrement(),
61+
title: text('title').notNull(),
62+
content: text('content').notNull(),
63+
userId: int('user_id').notNull().references(users, 'id'),
64+
})
65+
66+
// Define relations
67+
const usersRelations = relations(users, ({ many }) => ({
68+
posts: many(posts),
69+
}))
70+
71+
const postsRelations = relations(posts, ({ one }) => ({
72+
user: one(users, {
73+
fields: [posts._.columns.userId],
74+
references: [users._.columns.id],
75+
}),
76+
}))
77+
78+
// Initialize ORM
79+
const db = await Database.load('sqlite:mydb.db')
80+
const orm = new TauriORM(db, {
81+
users,
82+
usersRelations,
83+
posts,
84+
postsRelations,
85+
})
86+
87+
// Run migrations
88+
await orm.migrate()
89+
90+
// Query with relations
91+
const usersWithPosts = await orm
92+
.select(users)
93+
.include({ posts: true })
94+
.all()
95+
```
96+
97+
### Documentation
98+
99+
- [Many-to-Many Relations Guide](https://github.com/Type-32/tauri-sqlite-orm/blob/dev/docs/many-to-many-example.md) - Learn how to implement many-to-many relationships with junction tables
100+
- [Advanced Queries Guide](https://github.com/Type-32/tauri-sqlite-orm/blob/dev/docs/advanced-queries-example.md) - Learn about `.toSQL()`, aggregates, and subqueries
101+
- [Error Handling and Safety](https://github.com/Type-32/tauri-sqlite-orm/blob/dev/docs/error-handling-and-safety.md) - Learn about WHERE validation, increment/decrement, and error handling
102+
103+
### Relations
104+
105+
The ORM supports three types of relations:
106+
107+
1. **One-to-One / Many-to-One**: Use `one()` to define a relation where the current table references another table
108+
2. **One-to-Many**: Use `many()` to define a relation where another table references the current table
109+
3. **Many-to-Many**: Use `manyToMany()` to define a many-to-many relation through a junction table
110+
111+
See the [many-to-many example](https://github.com/Type-32/tauri-sqlite-orm/blob/dev/docs/many-to-many-example.md) for detailed usage.
137 KB
Loading
124 KB
Loading

0 commit comments

Comments
 (0)