8000 GitHub - LordRahl90/catalog-sorter
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

LordRahl90/catalog-sorter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extensible Sorting

Setup

  • Clone repository
  • run go mod tidy
  • run make run order=asc plugin=svp path="cmd/testdata/products.json"
    NB: The variables can be alternated to various options

Using the provided json data, the following result should be expected:

[
        {
                "id": 1,
                "name": "Alabaster Table",
                "price": 12.99,
                "created": "2019-01-04",
                "sales_count": 32,
                "views_count": 730
        },
        {
                "id": 3,
                "name": "Coffee Table",
                "price": 10,
                "created": "2014-05-28",
                "sales_count": 1048,
                "vi
5764
ews_count": 20123
        },
        {
                "id": 2,
                "name": "Zebra Table",
                "price": 44.49,
                "created": "2012-01-04",
                "sales_count": 301,
                "views_count": 3279
        }
]

Contribution

To add a new plugin, create a package that implements the sorter.SortPlugin interface, then register it in the plugins map in main.go using a unique name as the key and the new plugin service as the value.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0