Documentation ¶
Index ¶
- Constants
- type Expression
- type PlanInfo
- type Predicate
- func (p *Predicate) ConjoinWith(pred *Predicate)
- func (p *Predicate) EquatesWithConstant(fldname string) *record.Constant
- func (p *Predicate) EquatesWithField(fldname string) string
- func (p *Predicate) IsSatisfied(s Scan) bool
- func (p *Predicate) JoinSubPred(sch1, sch2 *record.Schema) *Predicate
- func (p *Predicate) ReductionFactor(plan PlanInfo) int
- func (p *Predicate) SelectSubPred(sch *record.Schema) *Predicate
- func (p *Predicate) String() string
- type ProductScan
- func (ps *ProductScan) BeforeFirst()
- func (ps *ProductScan) Close()
- func (ps *ProductScan) GetInt(fldname string) int
- func (ps *ProductScan) GetString(fldname string) string
- func (ps *ProductScan) GetVal(fldname string) *record.Constant
- func (ps *ProductScan) HasField(fldname string) bool
- func (ps *ProductScan) Next() bool
- type ProjectScan
- func (ps *ProjectScan) BeforeFirst()
- func (ps *ProjectScan) Close()
- func (ps *ProjectScan) GetInt(fldname string) int
- func (ps *ProjectScan) GetString(fldname string) string
- func (ps *ProjectScan) GetVal(fldname string) *record.Constant
- func (ps *ProjectScan) HasField(fldname string) bool
- func (ps *ProjectScan) Next() bool
- type Scan
- type SelectScan
- func (ss *SelectScan) BeforeFirst()
- func (ss *SelectScan) Close()
- func (ss *SelectScan) Delete()
- func (ss *SelectScan) GetInt(fldname string) int
- func (ss *SelectScan) GetRid() *record.RID
- func (ss *SelectScan) GetString(fldname string) string
- func (ss *SelectScan) GetVal(fldname string) *record.Constant
- func (ss *SelectScan) HasField(fldname string) bool
- func (ss *SelectScan) Insert()
- func (ss *SelectScan) MoveToRid(rid *record.RID)
- func (ss *SelectScan) Next() bool
- func (ss *SelectScan) SetInt(fldname string, val int)
- func (ss *SelectScan) SetString(fldname string, val string)
- func (ss *SelectScan) SetVal(fldname string, val *record.Constant)
- type Term
- type UpdateScan
Constants ¶
const MAX_TERMS = 10
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression corresponds to SQL expressions.
func NewConstantExpression ¶
func NewConstantExpression(val *record.Constant) *Expression
NewConstantExpression creates a new expression with a constant value.
func NewFieldExpression ¶
func NewFieldExpression(fldname string) *Expression
NewFieldExpression creates a new expression with a field name.
func (*Expression) AppliesTo ¶
func (e *Expression) AppliesTo(sch *record.Schema) bool
AppliesTo determines if all of the fields mentioned in this expression are contained in the specified schema.
func (*Expression) AsConstant ¶
func (e *Expression) AsConstant() *record.Constant
AsConstant returns the constant corresponding to a constant expression, or nil if the expression does not denote a constant.
func (*Expression) AsFieldName ¶
func (e *Expression) AsFieldName() string
AsFieldName returns the field name corresponding to a constant expression, or an empty string if the expression does not denote a field.
func (*Expression) Evaluate ¶
func (e *Expression) Evaluate(s Scan) *record.Constant
Evaluate evaluates the expression with respect to the current record of the specified scan.
func (*Expression) IsFieldName ¶
func (e *Expression) IsFieldName() bool
IsFieldName returns true if the expression is a field reference.
func (*Expression) ToString ¶
func (e *Expression) ToString() string
ToString returns the string representation of the expression.
type Predicate ¶
type Predicate struct {
// contains filtered or unexported fields
}
Predicate is a Boolean combination of terms.
func NewPredicate ¶
NewPredicate creates an empty predicate, corresponding to "true".
func NewPredicateWithTerm ¶
NewPredicateWithTerm creates a predicate containing a single term.
func (*Predicate) ConjoinWith ¶
ConjoinWith modifies the predicate to be the conjunction of itself and the specified predicate.
func (*Predicate) EquatesWithConstant ¶
EquatesWithConstant determines if there is a term of the form "F=c" where F is the specified field and c is some constant.
func (*Predicate) EquatesWithField ¶
EquatesWithField determines if there is a term of the form "F1=F2" where F1 is the specified field and F2 is another field.
func (*Predicate) IsSatisfied ¶
IsSatisfied returns true if the predicate evaluates to true with respect to the specified scan.
func (*Predicate) JoinSubPred ¶
JoinSubPred returns the subpredicate consisting of terms that apply to the union of the two specified schemas, but not to either schema separately.
func (*Predicate) ReductionFactor ¶
ReductionFactor calculates the extent to which selecting on the predicate reduces the number of records output by a query.
func (*Predicate) SelectSubPred ¶
SelectSubPred returns the subpredicate that applies to the specified schema.
type ProductScan ¶
type ProductScan struct {
// contains filtered or unexported fields
}
ProductScan corresponds to the product relational algebra operator.
func NewProductScan ¶
func NewProductScan(s1, s2 Scan) *ProductScan
NewProductScan creates a product scan having the two underlying scans.
func (*ProductScan) BeforeFirst ¶
func (ps *ProductScan) BeforeFirst()
BeforeFirst positions the scan before its first record. In particular, the LHS scan is positioned at its first record, and the RHS scan is positioned before its first record.
func (*ProductScan) GetInt ¶
func (ps *ProductScan) GetInt(fldname string) int
GetInt returns the integer value of the specified field. The value is obtained from whichever scan contains the field.
func (*ProductScan) GetString ¶
func (ps *ProductScan) GetString(fldname string) string
GetString returns the string value of the specified field. The value is obtained from whichever scan contains the field.
func (*ProductScan) GetVal ¶
func (ps *ProductScan) GetVal(fldname string) *record.Constant
GetVal returns the value of the specified field. The value is obtained from whichever scan contains the field.
func (*ProductScan) HasField ¶
func (ps *ProductScan) HasField(fldname string) bool
HasField returns true if the specified field is in either of the underlying scans.
func (*ProductScan) Next ¶
func (ps *ProductScan) Next() bool
Next moves the scan to the next record. The method moves to the next RHS record, if possible. Otherwise, it moves to the next LHS record and the first RHS record. If there are no more LHS records, the method returns false.
type ProjectScan ¶
type ProjectScan struct {
// contains filtered or unexported fields
}
func NewProjectScan ¶
func NewProjectScan(s Scan, fieldlist []string) *ProjectScan
func (*ProjectScan) BeforeFirst ¶
func (ps *ProjectScan) BeforeFirst()
func (*ProjectScan) Close ¶
func (ps *ProjectScan) Close()
func (*ProjectScan) GetInt ¶
func (ps *ProjectScan) GetInt(fldname string) int
func (*ProjectScan) GetString ¶
func (ps *ProjectScan) GetString(fldname string) string
func (*ProjectScan) HasField ¶
func (ps *ProjectScan) HasField(fldname string) bool
func (*ProjectScan) Next ¶
func (ps *ProjectScan) Next() bool
type Scan ¶
type Scan interface { // BeforeFirst positions the scan before its first record. // A subsequent call to Next will return the first record. BeforeFirst() // Next moves the scan to the next record. // Returns false if there is no next record. Next() bool // GetInt returns the value of the specified integer field in the current record. // The fldname parameter represents the name of the field. GetInt(fldname string) int // GetString returns the value of the specified string field in the current record. // The fldname parameter represents the name of the field. GetString(fldname string) string // GetVal returns the value of the specified field in the current record, expressed as a Constant. // The fldname parameter represents the name of the field. GetVal(fldname string) *record.Constant // HasField checks if the scan has the specified field. // The fldname parameter represents the name of the field. // Returns true if the scan has that field. HasField(fldname string) bool // Close closes the scan and its subscans, if any. Close() }
type SelectScan ¶
type SelectScan struct {
// contains filtered or unexported fields
}
func NewSelectScan ¶
func NewSelectScan(s Scan, pred Predicate) *SelectScan
NewSelectScan creates a new SelectScan instance
func (*SelectScan) BeforeFirst ¶
func (ss *SelectScan) BeforeFirst()
BeforeFirst positions the scan before its first record
func (*SelectScan) Close ¶
func (ss *SelectScan) Close()
func (*SelectScan) Delete ¶
func (ss *SelectScan) Delete()
func (*SelectScan) GetInt ¶
func (ss *SelectScan) GetInt(fldname string) int
func (*SelectScan) GetRid ¶
func (ss *SelectScan) GetRid() *record.RID
func (*SelectScan) GetString ¶
func (ss *SelectScan) GetString(fldname string) string
func (*SelectScan) HasField ¶
func (ss *SelectScan) HasField(fldname string) bool
func (*SelectScan) Insert ¶
func (ss *SelectScan) Insert()
func (*SelectScan) MoveToRid ¶
func (ss *SelectScan) MoveToRid(rid *record.RID)
func (*SelectScan) Next ¶
func (ss *SelectScan) Next() bool
Next moves the scan to the next record and returns true if there is such a record
func (*SelectScan) SetInt ¶
func (ss *SelectScan) SetInt(fldname string, val int)
func (*SelectScan) SetString ¶
func (ss *SelectScan) SetString(fldname string, val string)
type Term ¶
type Term struct {
// contains filtered or unexported fields
}
func NewTerm ¶
func NewTerm(lhs, rhs Expression) *Term
NewTerm creates a new Term instance with two expressions
func (*Term) EquatesWithConstant ¶
func (*Term) EquatesWithField ¶
func (*Term) IsSatisfied ¶
func (*Term) ReductionFactor ¶
type UpdateScan ¶
type UpdateScan interface { Scan // Embed the Scan interface // SetVal modifies the field value of the current record using a Constant SetVal(fldname string, val *record.Constant) // SetInt modifies the field value of the current record with an integer value SetInt(fldname string, val int) // SetString modifies the field value of the current record with a string value SetString(fldname string, val string) // Insert inserts a new record somewhere in the scan Insert() // Delete deletes the current record from the scan Delete() // GetRid returns the ID of the current record GetRid() *record.RID // MoveToRid positions the scan so that the current record has the specified ID MoveToRid(rid *record.RID) }