Socket
Book a DemoInstallSign in
Socket

github.com/filllabs/sincap-common

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/filllabs/sincap-common

v1.0.15
Source
Go
Version published
Created
Source

sincap-common

common libs, utils

  • chi for routing.
  • structs for reflection.
  • zap for logging.
  • melody for websockets.
  • gorm for persisting.
  • testify for asserting.

Test

go get -u github.com/gophertown/looper
looper

Query API

Multi level searches only works with SingularTableNames for PolymorphicModel and for equals

Field selection

Give the API consumer the ability to choose returned fields. This will also reduce the network traffic and speed up the usage of the API.

GET /cars?_fields=manufacturer,model,id,color

Preload selection

Give the API consumer the ability to choose preloaded (eager) relations. This will also reduce the network traffic and speed up the usage of the API.

GET /cars?_preloads=manufacturer,model,id,color

Paging

GET /cars?_offset=10&_limit=5
  • Add _offset and _limit (an X-Total-Count header is included in the response).

  • To send the total entries back to the user use the custom HTTP header: X-Total-Count.

  • Content-Range offset – limit / count.

    • offset: Index of the first element returned by the request.

    • limit: Index of the last element returned by the request.

    • count: Total number of elements in the collection.

  • Accept-Range resource max.

Sorting

  • Allow ascending and descending sorting over multiple fields.
  • Use sort with underscore as _sort.
  • In code, descending describe as -, ascending describe as +.

GET /cars?_sort=-manufactorer,+model

Operators

  • Add _filter query parameter and continue with field names,operations and values separated by ,.
  • Pattern _filter=<fieldname><operation><value>.
  • Supported operations.
    • = equal
    • != not equal
    • < less
    • <= less or equals
    • > greater
    • >= greater or equals
    • ~= like
    • |= in (values must be separated with |
    • *= in alternative (values must be separated with *
  • NULL/mull/nil id reserved word. For ex. Name=NULL or Name!=NULL becomes IS NULL or IS NOT NULL

GET http://127.0.0.1:8080/app/users?_filter=name=seray,active=true

  • Add _q.

GET /cars?_q=nissan

FAQs

Package last updated on 30 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.