Giter Club home page Giter Club logo

gorm-deep-filtering's Introduction

๐ŸŒŒ Gorm Deep Filtering Plugin

Go package GitHub GitHub go.mod Go version

Ever wanted to filter objects on a deep level using only maps? This plugin allows you to do just that.

package main

func main () {
	filters := map[string]any{
		"name": "abc",
		"related_object": map[string]any{
			"title": "engineer",
		},
	}
}

Is automatically turned into a query that looks like this:

SELECT * FROM employees WHERE related_object_id IN (SELECT id FROM occupations WHERE title = "engineer")

๐Ÿ’ก Related Libraries

  • gormlike turns WHERE-calls into LIkE queries if certain tokens were found
  • gormqonvert turns WHERE-calls into different queries if certain tokens were found
  • gormcase adds case insensitivity to WHERE queries
  • gormtestutil provides easy utility methods for unit-testing with gorm

โฌ‡๏ธ Installation

go get github.com/survivorbat/gorm-deep-filtering

๐Ÿ“‹ Usage

package main

import (
    "github.com/survivorbat/gorm-deep-filtering"
)

func main() {
	db, _ := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
	
	// Adds deep filtering
	db.Use(deepgorm.New())
}

๐Ÿ”ญ Plans

Better error handling, logging.

gorm-deep-filtering's People

Contributors

survivorbat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

addshore bramca

gorm-deep-filtering's Issues

Where is v0.0.8 ?

Hi @survivorbat

I just started using this package and was going to provide a PR improvement for some many2many relation stuff.
However I appear to be using v0.0.8 but I can't actually find that tag / the code in this repo?
Can you offer some help? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.