AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
ASqlBlueprint.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 Alex2772 and Contributors
    4 *
    5 * SPDX-License-Identifier: MPL-2.0
    6 *
    7 * This Source Code Form is subject to the terms of the Mozilla Public
    8 * License, v. 2.0. If a copy of the MPL was not distributed with this
    9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   10 */
   11
   12#pragma once
   13#include "ASqlDatabase.h"
   14#include "AUI/Autumn/Autumn.h"
   15
   16class AString;
   17
   18class API_AUI_DATA ASqlBlueprintColumn
   19{
   20    friend class ASqlBlueprintTable;
   21private:
   22    AString mTableName;
   23    AString mColumnName;
   24    AString mType;
   25
   26    bool mIsUnique = false;
   27    bool mIsNotNull = false;
   28
   29    ASqlBlueprintColumn(const AString& table_name, const AString& column_name, const AString& type);
   30
   31public:
   32    ASqlBlueprintColumn(const ASqlBlueprintColumn&) = delete;
   33    ~ASqlBlueprintColumn();
   34
   35    ASqlBlueprintColumn& unique();
   36    ASqlBlueprintColumn& notNull();
   37};
   38
   39class API_AUI_DATA ASqlBlueprintTable
   40{
   41private:
   42    AString mTableName;
   43
   44
   45    ASqlBlueprintTable(_<ASqlDatabase> db, const AString& name);
   46public:
   47    ASqlBlueprintTable(const AString& name):
   48        ASqlBlueprintTable(Autumn::get<ASqlDatabase>(), name)
   49    {
   50    }
   51
   52    ASqlBlueprintColumn integer(const AString& columnName);
   53    ASqlBlueprintColumn varchar(const AString& columnName, unsigned size = 0xff);
   54    ASqlBlueprintColumn text(const AString& columnName);
   55};
Definition ASqlBlueprint.h:19
Represents a Unicode character string.
Definition AString.h:38
An std::weak_ptr with AUI extensions.
Definition SharedPtrTypes.h:179