mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
* Restructure data layer part 2 (#2599) * Refactor and separate image model * Refactor image query builder * Handle relationships in image query builder * Remove relationship management methods * Refactor gallery model/query builder * Add scenes to gallery model * Convert scene model * Refactor scene models * Remove unused methods * Add unit tests for gallery * Add image tests * Add scene tests * Convert unnecessary scene value pointers to values * Convert unnecessary pointer values to values * Refactor scene partial * Add scene partial tests * Refactor ImagePartial * Add image partial tests * Refactor gallery partial update * Add partial gallery update tests * Use zero/null package for null values * Add files and scan system * Add sqlite implementation for files/folders * Add unit tests for files/folders * Image refactors * Update image data layer * Refactor gallery model and creation * Refactor scene model * Refactor scenes * Don't set title from filename * Allow galleries to freely add/remove images * Add multiple scene file support to graphql and UI * Add multiple file support for images in graphql/UI * Add multiple file for galleries in graphql/UI * Remove use of some deprecated fields * Remove scene path usage * Remove gallery path usage * Remove path from image * Move funscript to video file * Refactor caption detection * Migrate existing data * Add post commit/rollback hook system * Lint. Comment out import/export tests * Add WithDatabase read only wrapper * Prepend tasks to list * Add 32 pre-migration * Add warnings in release and migration notes
90 lines
4.4 KiB
Go
90 lines
4.4 KiB
Go
package exp
|
|
|
|
type bitwise struct {
|
|
lhs Expression
|
|
rhs interface{}
|
|
op BitwiseOperation
|
|
}
|
|
|
|
func NewBitwiseExpression(op BitwiseOperation, lhs Expression, rhs interface{}) BitwiseExpression {
|
|
return bitwise{op: op, lhs: lhs, rhs: rhs}
|
|
}
|
|
|
|
func (b bitwise) Clone() Expression {
|
|
return NewBitwiseExpression(b.op, b.lhs.Clone(), b.rhs)
|
|
}
|
|
|
|
func (b bitwise) RHS() interface{} {
|
|
return b.rhs
|
|
}
|
|
|
|
func (b bitwise) LHS() Expression {
|
|
return b.lhs
|
|
}
|
|
|
|
func (b bitwise) Op() BitwiseOperation {
|
|
return b.op
|
|
}
|
|
|
|
func (b bitwise) Expression() Expression { return b }
|
|
func (b bitwise) As(val interface{}) AliasedExpression { return NewAliasExpression(b, val) }
|
|
func (b bitwise) Eq(val interface{}) BooleanExpression { return eq(b, val) }
|
|
func (b bitwise) Neq(val interface{}) BooleanExpression { return neq(b, val) }
|
|
func (b bitwise) Gt(val interface{}) BooleanExpression { return gt(b, val) }
|
|
func (b bitwise) Gte(val interface{}) BooleanExpression { return gte(b, val) }
|
|
func (b bitwise) Lt(val interface{}) BooleanExpression { return lt(b, val) }
|
|
func (b bitwise) Lte(val interface{}) BooleanExpression { return lte(b, val) }
|
|
func (b bitwise) Asc() OrderedExpression { return asc(b) }
|
|
func (b bitwise) Desc() OrderedExpression { return desc(b) }
|
|
func (b bitwise) Like(i interface{}) BooleanExpression { return like(b, i) }
|
|
func (b bitwise) NotLike(i interface{}) BooleanExpression { return notLike(b, i) }
|
|
func (b bitwise) ILike(i interface{}) BooleanExpression { return iLike(b, i) }
|
|
func (b bitwise) NotILike(i interface{}) BooleanExpression { return notILike(b, i) }
|
|
func (b bitwise) RegexpLike(val interface{}) BooleanExpression { return regexpLike(b, val) }
|
|
func (b bitwise) RegexpNotLike(val interface{}) BooleanExpression { return regexpNotLike(b, val) }
|
|
func (b bitwise) RegexpILike(val interface{}) BooleanExpression { return regexpILike(b, val) }
|
|
func (b bitwise) RegexpNotILike(val interface{}) BooleanExpression { return regexpNotILike(b, val) }
|
|
func (b bitwise) In(i ...interface{}) BooleanExpression { return in(b, i...) }
|
|
func (b bitwise) NotIn(i ...interface{}) BooleanExpression { return notIn(b, i...) }
|
|
func (b bitwise) Is(i interface{}) BooleanExpression { return is(b, i) }
|
|
func (b bitwise) IsNot(i interface{}) BooleanExpression { return isNot(b, i) }
|
|
func (b bitwise) IsNull() BooleanExpression { return is(b, nil) }
|
|
func (b bitwise) IsNotNull() BooleanExpression { return isNot(b, nil) }
|
|
func (b bitwise) IsTrue() BooleanExpression { return is(b, true) }
|
|
func (b bitwise) IsNotTrue() BooleanExpression { return isNot(b, true) }
|
|
func (b bitwise) IsFalse() BooleanExpression { return is(b, false) }
|
|
func (b bitwise) IsNotFalse() BooleanExpression { return isNot(b, false) }
|
|
func (b bitwise) Distinct() SQLFunctionExpression { return NewSQLFunctionExpression("DISTINCT", b) }
|
|
func (b bitwise) Between(val RangeVal) RangeExpression { return between(b, val) }
|
|
func (b bitwise) NotBetween(val RangeVal) RangeExpression { return notBetween(b, val) }
|
|
|
|
// used internally to create a Bitwise Inversion BitwiseExpression
|
|
func bitwiseInversion(rhs Expression) BitwiseExpression {
|
|
return NewBitwiseExpression(BitwiseInversionOp, nil, rhs)
|
|
}
|
|
|
|
// used internally to create a Bitwise OR BitwiseExpression
|
|
func bitwiseOr(lhs Expression, rhs interface{}) BitwiseExpression {
|
|
return NewBitwiseExpression(BitwiseOrOp, lhs, rhs)
|
|
}
|
|
|
|
// used internally to create a Bitwise AND BitwiseExpression
|
|
func bitwiseAnd(lhs Expression, rhs interface{}) BitwiseExpression {
|
|
return NewBitwiseExpression(BitwiseAndOp, lhs, rhs)
|
|
}
|
|
|
|
// used internally to create a Bitwise XOR BitwiseExpression
|
|
func bitwiseXor(lhs Expression, rhs interface{}) BitwiseExpression {
|
|
return NewBitwiseExpression(BitwiseXorOp, lhs, rhs)
|
|
}
|
|
|
|
// used internally to create a Bitwise LEFT SHIFT BitwiseExpression
|
|
func bitwiseLeftShift(lhs Expression, rhs interface{}) BitwiseExpression {
|
|
return NewBitwiseExpression(BitwiseLeftShiftOp, lhs, rhs)
|
|
}
|
|
|
|
// used internally to create a Bitwise RIGHT SHIFT BitwiseExpression
|
|
func bitwiseRightShift(lhs Expression, rhs interface{}) BitwiseExpression {
|
|
return NewBitwiseExpression(BitwiseRightShiftOp, lhs, rhs)
|
|
}
|