diff --git a/position.go b/position.go index 0ac907c..c17bff8 100644 --- a/position.go +++ b/position.go @@ -18,12 +18,12 @@ type Position struct { // String representation of the position. // Displays 1-indexed line and column numbers. -func (p *Position) String() string { +func (p Position) String() string { return fmt.Sprintf("(%d, %d)", p.Line, p.Col) } // Invalid returns whether or not the position is valid (i.e. with negative or // null values) -func (p *Position) Invalid() bool { +func (p Position) Invalid() bool { return p.Line <= 0 || p.Col <= 0 } diff --git a/query.go b/query.go index f44848b..307a1ec 100644 --- a/query.go +++ b/query.go @@ -30,7 +30,7 @@ func (r *QueryResult) appendResult(node interface{}, pos Position) { // Values is a set of values within a QueryResult. The order of values is not // guaranteed to be in document order, and may be different each time a query is // executed. -func (r *QueryResult) Values() []interface{} { +func (r QueryResult) Values() []interface{} { values := make([]interface{}, len(r.items)) for i, v := range r.items { o, ok := v.(*tomlValue) @@ -45,7 +45,7 @@ func (r *QueryResult) Values() []interface{} { // Positions is a set of positions for values within a QueryResult. Each index // in Positions() corresponds to the entry in Value() of the same index. -func (r *QueryResult) Positions() []Position { +func (r QueryResult) Positions() []Position { return r.positions }