npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

autosqlserverapi

v1.0.5

Published

Forntend Library for using AutoSqlServerApi

Downloads

2

Readme

AutoSqlServerApi work with Asp.Net Core .net 5.0 and above. AutoSqlServerApi can create CRUD Api for your Sql Server by just adding a middleware in your Startup. Installation: Install AutoSqlServerApi Nuget package in your asp.net core application then Add Middleware in Startup file. app.UseAutoSqlServerApi("/api/values","SqlUser"); Following is the full signature for the UseAutoSqlServerApi Middleware. UseAutoSqlServerApi(ApiPath,Role); T: T is type of Microsoft.EntityFrameworkCore.DbContext ApiPath: this path will be used by AutoSqlServerApi every request to this path will going to be handled by UseAutoSqlServerApi. if your are using http://example.com for your application then by giving ApiPath="/api/values" api path is going to be: http://example.com/api/values/
And use me be in "SqlUser" role to use this api. Usage: to use this package you have to send a json object to api, object is given below; { top: "2",// how many rows you need select: ["column1","column2","column2"],//string array leave empty to select all columns where: [ { name:"columnName", value:"value", operator:"=" } ],//array of object to filter data groupBy: ["column1","column2"],//string array leave empty if no group by required orderBy:[ {name:"column1",by:"ASC|DESC"} ],//array of ordering columns, leave empty if required none isDistinct: true|false, betweens: [ { name:"columnName", value1:"",value2:"" } ]//arrayof objects for checking value of a column to be between in value1 and value2 , leave empty if required none

AutSqlServerApi also have ha npm package for create this object automatically for you. just add autosqlserverapi in your angular or react (or any client side framework how usage Typescript or Javascript) Usage of npm autosqlserverapi package: set your api path in dotNetApiPath variable of AutoSqlconfig; dotNetApiPath="http://example.com/api/values/"

Now Create a class for representing your Sql Server Table or View like : class Employee { EmployeeID: string LastName: string FirstName: string Title: string TitleOfCourtesy: string BirthDate: string HireDate: string Address: string City: string Region: string PostalCode: string Country: string HomePhone: string Extension: string Photo: string Notes: string ReportsTo: string PhotoPath: string }

now crate a object of AutoSqlTable or View

var employees=new AutoSqlTable("Employees");

Signature for crating new AutoSqlTable or AutSqlView Object AutoSqlTable(tableName); T: T is your class type who represent your Table or View(All properties name must match the table columns name)

tableName: name of the table in your database;

Now you can use the employees object for: Getting the data of table, Filterint the table data, for updateing the row, for adding new row get the count of table rows and more. available methods in npm package

⦁ first() ⦁ select([]) ⦁ desc() ⦁ asc() ⦁ distinct() ⦁ orderBy() ⦁ where ⦁ get ⦁ count ⦁ take ⦁ delete ⦁ add ⦁ update

first: first() method will return the top row of table eg: employees.select(["Id,name"]).desc("id").first().getResult(p=>{ console.log(p) }); select: select selcted columns form the table eg: employees.select(["Id,name"]).getResult(p=>{ console.log(p) }); desc(columnName): select result in desc order asc(columnName); select result in asc order orderBy([obj]): employees.orderBy([{ name: "Year", by: SqlSortTypes.DESC }]) wll order the result by given array Where: will return the object of WhereClause set on the given column name; In where clause you can create a chain of metods to filter the data like this employees.where("DOBMonth").between("1", "2").where("id").above("1").getResult() WhereClause have following Methods above(val:string); aboveOrEqual(val); below(val) ; belowOrEqual(val) between(val1, val2) equals(val) notEquals(val); isNull() isNotNull() WhereClause metods returns the object of your tableClass so you can add another filter on the table.