Skip to content

a revolutionary utility extension for seamless Prisma integration.

License

Notifications You must be signed in to change notification settings

rojanmagar2001/prisma-fns

 
 

Repository files navigation

Prisma Utils

v1.2.0 Just landed 🚀

npm version Build Status GitHub Repo stars GitHub top language License

Prisma Utils is a revolutionary utility extension for seamless Prisma integration. It enhances your workflow, simplifies common tasks and functions, and boosts the efficiency of your Prisma-powered applications.

Features

  • Reusable fns: Construct complex queries effortlessly.
  • Utilities: Additional tools to enhance your Prisma experience.

Installation

npm install prisma-fns

Basic Usage

Get Values

// getValues (field, where)
const prisma = new PrismaClient().$extends(getValues);

const user = await prisma.user.getValues("email", {
  email: {
    contains: "@",
  },
});

Log

// console.log
const prisma = new PrismaClient().$extends(log);

const user = await prisma.user.findFirst();

prisma.$log(user);

Exists

const prisma = new PrismaClient().$extends(exists);

// returns boolean
const user = await prisma.user.exists({
  id: 1,
});

logPerf

const prisma = new PrismaClient().$extends(logPerf);

const user = await prisma.user.findFirst();


// logs in console
{
  model: 'User',
  operation: 'findFirst',
  args: {},
  time: 25.3997129797935
}

remember

// creates singleton
const prisma = new PrismaClient().$extends(remember);

save

// saves object
const prisma = new PrismaClient().$extends(save);

generate slug

const prisma = new PrismaClient().$extends(generateSlug);

const user = await prisma.user.findFirst();

// returns slug
user.slug;

Support

If you like the project, please consider supporting us by giving a ⭐️ on Github.

Bugs

If you find a bug, please file an issue on our issue tracker on GitHub

Contributing

If you'd like to contribute, please follow our contribution guidelines.

License

prisma-fns is open-source software licensed under the MIT license.

About

a revolutionary utility extension for seamless Prisma integration.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.3%
  • Shell 0.7%