sequalized 0.0.1

A simple postgres orm


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Sequelized ( WIP ) ( Tested only on windows)

This is a simple postgre based ORM based on JS sequelize

Support: pg 16

Must be added this on dub.json for windows

"libs": [ "pq" ],
    "lflags-windows-x86_64": [ "-LIBPATH:C:/Program Files/PostgreSQL/16/lib/" ],
    "copyFiles-windows-x86_64": [
        "C:/Program Files/PostgreSQL/16/lib/libpq.dll",
        "C:/Program Files/PostgreSQL/16/bin/libintl-9.dll",
        "C:/Program Files/PostgreSQL/16/bin/libssl-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libcrypto-3-x64.dll",
		"C:/Program Files/PostgreSQL/16/bin/libwinpthread-1.dll",
		"C:/Program Files/PostgreSQL/16/bin/libiconv-2.dll"
    ],

Initialize Connection

  import postgre._internal.connection;
  Postgres c = new Postgres(DatabaseConnectionOption);

Creating Models


class Users
{
	mixin Model;

	@Type(DataTypes.SERIAL)
	@PmKey()
	@NotNull()
	long id;

	@Type(DataTypes.VARCHAR)
	@NotNull()
	string name = null;
}

Usage

  • insert

    	Users u = new Users();
    	u.name = "John Doe"
    	auto id = u.insert();
    

    returns the inserted data id

  • delete

    u.destroy();
    
  • update

    WhereClause w = WhereClause();
    u.name="John Smith"
    u.update(w.eq("name",1))
    
  • select

    u.select(w.eq("name","John Smith"))
    
Authors:
  • Robert Devasia
Dependencies:
none
Versions:
0.0.1 2024-Nov-30
~main 2024-Dec-08
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
0.3
Short URL:
sequalized.dub.pm