예제 #1
0
파일: SqlBuilder.cs 프로젝트: yepeek/tzkt
        public SqlBuilder FilterA(string column, TimestampParameter value, Func <string, string> map = null)
        {
            if (value == null)
            {
                return(this);
            }

            if (value.Eq != null)
            {
                AppendFilter($@"{column} = {value.Eq}");
            }

            if (value.Ne != null)
            {
                AppendFilter($@"{column} != {value.Ne}");
            }

            if (value.Gt != null)
            {
                AppendFilter($@"{column} > {value.Gt}");
            }

            if (value.Ge != null)
            {
                AppendFilter($@"{column} >= {value.Ge}");
            }

            if (value.Lt != null)
            {
                AppendFilter($@"{column} < {value.Lt}");
            }

            if (value.Le != null)
            {
                AppendFilter($@"{column} <= {value.Le}");
            }

            if (value.In != null)
            {
                AppendFilter($@"{column} = ANY (@p{Counter})");
                Params.Add($"p{Counter++}", value.In);
            }

            if (value.Ni != null)
            {
                AppendFilter($@"NOT ({column} = ANY (@p{Counter}))");
                Params.Add($"p{Counter++}", value.Ni);
            }

            return(this);
        }
예제 #2
0
        public SqlBuilder Filter(string column, TimestampParameter value, Func <string, string> map = null)
        {
            if (value == null)
            {
                return(this);
            }

            if (value.Eq != null)
            {
                AppendFilter($@"""{column}"" = {value.Eq}");
            }

            if (value.Ne != null)
            {
                AppendFilter($@"""{column}"" != {value.Ne}");
            }

            if (value.Gt != null)
            {
                AppendFilter($@"""{column}"" > {value.Gt}");
            }

            if (value.Ge != null)
            {
                AppendFilter($@"""{column}"" >= {value.Ge}");
            }

            if (value.Lt != null)
            {
                AppendFilter($@"""{column}"" < {value.Lt}");
            }

            if (value.Le != null)
            {
                AppendFilter($@"""{column}"" <= {value.Le}");
            }

            if (value.In != null)
            {
                AppendFilter($@"""{column}"" = ANY ({Param(value.In)})");
            }

            if (value.Ni != null)
            {
                AppendFilter($@"NOT (""{column}"" = ANY ({Param(value.Ni)}))");
            }

            return(this);
        }