relx 0.1.0
A Modern C++23 Type-Safe SQL Query Builder
Loading...
Searching...
No Matches
command_line_tools.hpp File Reference
#include "core.hpp"
#include <fstream>
#include <functional>
#include <iostream>
#include <optional>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  relx::migrations::cli::CommandLineArgs
 Command-line argument parsing result. More...
 

Namespaces

namespace  relx
 relx database connection
 
namespace  relx::migrations
 
namespace  relx::migrations::cli
 

Typedefs

using relx::migrations::cli::MigrationGenerator = std::function< MigrationResult< Migration >(const std::string &, const std::string &)>
 Type alias for a function that generates a migration between two versions.
 
using relx::migrations::cli::CreateMigrationGenerator = std::function< MigrationResult< Migration >(const std::string &)>
 Type alias for a function that generates a create table migration.
 
using relx::migrations::cli::DropMigrationGenerator = std::function< MigrationResult< Migration >(const std::string &)>
 Type alias for a function that generates a drop table migration.
 

Functions

void relx::migrations::cli::print_usage (const char *program_name, const std::vector< std::string > &supported_versions={})
 Print usage information for a migration command-line tool.
 
void relx::migrations::cli::print_usage (const char *program_name, const std::vector< std::string > &supported_versions, bool create_available, bool drop_available)
 Print usage information for a migration command-line tool with customizable options.
 
void relx::migrations::cli::write_migration_to_file (const Migration &migration, const std::string &filename, bool include_rollback=true)
 Write a migration to a SQL file with proper formatting.
 
void relx::migrations::cli::print_migration (const Migration &migration)
 Print a migration to the console with formatting.
 
CommandLineArgs relx::migrations::cli::parse_args (const std::vector< std::string > &args)
 Parse command-line arguments for migration tools.
 
int relx::migrations::cli::run_migration_tool (int argc, char *argv[], const std::vector< std::string > &supported_versions, MigrationGenerator migration_generator, std::optional< CreateMigrationGenerator > create_generator=std::nullopt, std::optional< DropMigrationGenerator > drop_generator=std::nullopt)
 Run a complete migration command-line tool.