Created
March 3, 2018 01:51
-
-
Save alvinmespejo/189b420799147b77575e774906462dbc to your computer and use it in GitHub Desktop.
Realtor Preference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package preference | |
import ( | |
"circlepix/pkg/database" | |
"strings" | |
) | |
func ReadByID(Id int64) (*Preference, error) { | |
p := Preference{} | |
err := database.Get(&p, "SELECT * FROM Preference WHERE PrefId = ?", Id) | |
if err != nil { | |
return nil, err | |
} | |
return &p, nil | |
} | |
func GetPreferences(prefType string, prefTypeId int64) ([]*Preference, error) { | |
p := []*Preference{} | |
prefType = strings.ToLower(prefType) | |
err := database.Get(&p, "SELECT * FROM Preference WHERE PREFtype = ? AND PREFtypeId = ? ", prefType, prefTypeId) | |
if err != nil { | |
return nil, err | |
} | |
return p, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment