Describe the feature

Many of the gorm users facing filtering with zero value problem, includes me when I am a new user to gorm, and issues like this on and on: https://github.com/go-gorm/gorm/issues/6690 In java, there is a orm framework named mybatis-plus, it has a FieldStrategy enum, and a whereStrategy field, by setting whereStrategy to always developers can use a zero value(in java, that is the null value) for auto filtering.

public class DAO {
    @TableField(value = "user_name", whereStrategy = FieldStrategy.ALWAYS)
    private String userName;
}

I think by adding feature like FieldStrategy can solve the problem like this https://github.com/go-gorm/gorm/issues/6690

Motivation

To support auto filtering with zero field of a struct, make gorm more flexible, and more developers friendly.

Related Issues

https://github.com/go-gorm/gorm/issues/6690

cc @philicious

Comment From: philicious

I would suggest adding this globally to the GORM config so user can make it default for all queries

Comment From: github-actions[bot]

This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days