Comments (5)
Hey, sorry for the delayed reply. Let me look into it implementing a sort method.
from localstoragedb.
It will be great for sure! π
from localstoragedb.
I started implementation but quit as it no longer fit my needs. Feel free to pick it up. @ (https://github.com/a904guy/localStorageDB/blob/master/localstoragedb.js)
@line: 166
// sort records by field name (sort) returned from select
function sort(results,sort)
{
var r = [], sortable, s = sort;
for(var record in results)
{
record.sort(function(a,b)
{
if (typeof a[s].localeCompare === 'function') return a[s].localeCompare(b[s]);
return a[s] - b[s];
}
);
r.push(record);
}
return r;
}
@line: 619:
// select rows
query: function(table_name, query, limit, start, sort) {
tableExistsWarn(table_name);
var result_ids = [];
if(!query) {
result_ids = getIDs(table_name, limit, start); // no conditions given, return all records
} else if(typeof query == 'object') { // the query has key-value pairs provided
result_ids = queryByValues(table_name, validFields(table_name, query), limit, start);
} else if(typeof query == 'function') { // the query has a conditional map function provided
result_ids = queryByFunction(table_name, query, limit, start);
}
return sort(select(table_name, result_ids, limit),sort);
},
from localstoragedb.
from localstoragedb.
@juarezpaf, sorry it's been so long, but the multi-field sorting is now supported (63a1749). Thanks to @orangecoding.
from localstoragedb.
Related Issues (20)
- GroupBy SQL Query HOT 3
- queryAll query returns Cannot read property 'toString' of null HOT 3
- Not supporting cross-tabs HOT 3
- return false in queryAll HOT 1
- search values in array HOT 1
- Migrate database when update schema? HOT 1
- Is there NPM package for this? HOT 1
- I think the documentation is broken at Methods
- How to Drop Column with alterTable? HOT 2
- Do you intend to add the export import function?
- Updating NPM localstoragedb version HOT 1
- Update method removes ID from object by link
- Use in chrome Extensions ?
- Thank you
- my truncate not working HOT 1
- How can I delete that data when a value is zero? HOT 2
- How do I retrieve a value from local storage and set it in an HTML input field? HOT 1
- ε¦ζθΆ εΊε€§ε°ιεΆηθ―οΌζζη€ΊεοΌ
- I don't know if there's a bug in localstoragedb.d.ts or if I'm using it wrong. HOT 2
- IndexedDB vs localStorageDB?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localstoragedb.