Introducing db.h, a lightweight, header-only database solution in C, designed for seamless integration into your applications. With minimal setup, you can efficiently manage user data while keeping your code clean and concise. Simply include our header file, define your data types, and let db.h handle the rest, allowing you to focus on building great software.
db.h is a powerful, header-only database solution designed for simplicity and efficiency. It enables developers to easily manage data structures with minimal overhead, making it the perfect choice for lightweight applications and projects.
With db.h, you can swiftly integrate database functionalities into your C applications without the complexity of external dependencies. Here’s a quick example of how you can utilize this library:
#define DB_IMPLEMENTATION
#include "./db.h"
#include <time.h>
#include <stdio.h>
typedef struct {
size_t id;
time_t ts_created;
} User;
typedef struct {
size_t count;
User items[1024];
} Users;
int main(void)
{
Users* users = db_table(Users);
users->items[users->count++] = (User) {
.id = users->count,
.ts_created = time(0)
};
for (size_t i = 0; i < users->count; i++) {
User* it = &users->items[i];
printf("id: %zu, ts_created: %zu\n", it->id, it->ts_created);
}
return 0;
}
This fantastic library allows you to track and manipulate your data efficiently. With support for various data types and ease of use, db.h can serve as a reliable foundation for your application's data management needs. Transform your C development experience with this straightforward header-only database today!