Documentation ¶
Index ¶
- func BarFilter(filterFunc func(bar *Bar) bool) func(query *BarQuery) *BarQuery
- func BarSort(sortFunc func(bars []*Bar)) func(query *BarQuery) *BarQuery
- func DeleteBar(userID int, datetime sheetdb.Datetime) error
- func DeleteFoo(userID int, fooID int) error
- func DeleteFooChild(userID int, fooID int, childID int) error
- func DeleteTypeTest(id int) error
- func DeleteUser(userID int) error
- func FooChildFilter(filterFunc func(fooChild *FooChild) bool) func(query *FooChildQuery) *FooChildQuery
- func FooChildSort(sortFunc func(fooChildren []*FooChild)) func(query *FooChildQuery) *FooChildQuery
- func FooFilter(filterFunc func(foo *Foo) bool) func(query *FooQuery) *FooQuery
- func FooSort(sortFunc func(foos []*Foo)) func(query *FooQuery) *FooQuery
- func Initialize(ctx context.Context, credentials, token, spreadsheetID string) error
- func LoadData(ctx context.Context) error
- func TypeTestFilter(filterFunc func(typeTest *TypeTest) bool) func(query *TypeTestQuery) *TypeTestQuery
- func TypeTestSort(sortFunc func(typeTests []*TypeTest)) func(query *TypeTestQuery) *TypeTestQuery
- func UserFilter(filterFunc func(user *User) bool) func(query *UserQuery) *UserQuery
- func UserSort(sortFunc func(users []*User)) func(query *UserQuery) *UserQuery
- type Bar
- func AddBar(userID int, datetime sheetdb.Datetime, value float32, note string) (*Bar, error)
- func GetBar(userID int, datetime sheetdb.Datetime) (*Bar, error)
- func GetBars(userID int, opts ...BarQueryOption) ([]*Bar, error)
- func UpdateBar(userID int, datetime sheetdb.Datetime, value float32, note string) (*Bar, error)
- type BarQuery
- type BarQueryOption
- type Foo
- func (m *Foo) AddFooChild(value string) (*FooChild, error)
- func (m *Foo) DeleteFooChild(childID int) error
- func (m *Foo) GetFooChild(childID int) (*FooChild, error)
- func (m *Foo) GetFooChildByValue(value string) (*FooChild, error)
- func (m *Foo) GetFooChildren(opts ...FooChildQueryOption) ([]*FooChild, error)
- func (m *Foo) UpdateFooChild(childID int, value string) (*FooChild, error)
- type FooChild
- func AddFooChild(userID int, fooID int, value string) (*FooChild, error)
- func GetFooChild(userID int, fooID int, childID int) (*FooChild, error)
- func GetFooChildByValue(userID int, fooID int, value string) (*FooChild, error)
- func GetFooChildren(userID int, fooID int, opts ...FooChildQueryOption) ([]*FooChild, error)
- func UpdateFooChild(userID int, fooID int, childID int, value string) (*FooChild, error)
- type FooChildQuery
- type FooChildQueryOption
- type FooQuery
- type FooQueryOption
- type Sex
- type TypeTest
- func AddTypeTest(stringValue string, boolValue bool, intValue int, int8Value int8, ...) (*TypeTest, error)
- func GetTypeTest(id int) (*TypeTest, error)
- func GetTypeTests(opts ...TypeTestQueryOption) ([]*TypeTest, error)
- func UpdateTypeTest(id int, stringValue string, boolValue bool, intValue int, int8Value int8, ...) (*TypeTest, error)
- type TypeTestQuery
- type TypeTestQueryOption
- type User
- func AddUser(name string, email string, sex Sex, birthday *sheetdb.Date) (*User, error)
- func GetUser(userID int) (*User, error)
- func GetUserByEmail(email string) (*User, error)
- func GetUsers(opts ...UserQueryOption) ([]*User, error)
- func UpdateUser(userID int, name string, email string, sex Sex, birthday *sheetdb.Date) (*User, error)
- func (m *User) AddBar(datetime sheetdb.Datetime, value float32, note string) (*Bar, error)
- func (m *User) AddFoo(value float32, note string) (*Foo, error)
- func (m *User) DeleteBar(datetime sheetdb.Datetime) error
- func (m *User) DeleteFoo(fooID int) error
- func (m *User) GetBar(datetime sheetdb.Datetime) (*Bar, error)
- func (m *User) GetBars(opts ...BarQueryOption) ([]*Bar, error)
- func (m *User) GetFoo(fooID int) (*Foo, error)
- func (m *User) GetFoos(opts ...FooQueryOption) ([]*Foo, error)
- func (m *User) UpdateBar(datetime sheetdb.Datetime, value float32, note string) (*Bar, error)
- func (m *User) UpdateFoo(fooID int, value float32, note string) (*Foo, error)
- type UserQuery
- type UserQueryOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteBar ¶
DeleteBar deletes bar from user. If it can not be found, this function returns *sheetdb.NotFoundError.
func DeleteFoo ¶
DeleteFoo deletes foo and it's children fooChild from user. If it can not be found, this function returns *sheetdb.NotFoundError.
func DeleteFooChild ¶
DeleteFooChild deletes fooChild from foo. If it can not be found, this function returns *sheetdb.NotFoundError.
func DeleteTypeTest ¶
DeleteTypeTest deletes typeTest. If it can not be found, this function returns *sheetdb.NotFoundError.
func DeleteUser ¶
DeleteUser deletes user and it's children foo, fooChild and bar. If it can not be found, this function returns *sheetdb.NotFoundError.
func FooChildFilter ¶
func FooChildFilter(filterFunc func(fooChild *FooChild) bool) func(query *FooChildQuery) *FooChildQuery
FooChildFilter is an option to change the filtering behavior of FooChildQuery.
func FooChildSort ¶
func FooChildSort(sortFunc func(fooChildren []*FooChild)) func(query *FooChildQuery) *FooChildQuery
FooChildSort is an option to change the sorting behavior of FooChildQuery.
func Initialize ¶
Initialize initializes this package.
func TypeTestFilter ¶
func TypeTestFilter(filterFunc func(typeTest *TypeTest) bool) func(query *TypeTestQuery) *TypeTestQuery
TypeTestFilter is an option to change the filtering behavior of TypeTestQuery.
func TypeTestSort ¶
func TypeTestSort(sortFunc func(typeTests []*TypeTest)) func(query *TypeTestQuery) *TypeTestQuery
TypeTestSort is an option to change the sorting behavior of TypeTestQuery.
func UserFilter ¶
UserFilter is an option to change the filtering behavior of UserQuery.
Types ¶
type Bar ¶
type Bar struct { UserID int `json:"user_id" db:"primarykey"` Datetime sheetdb.Datetime `json:"datetime" db:"primarykey"` Value float32 `json:"value"` Note string `json:"note" db:"allowempty"` }
Bar is a struct of bar which is a child of user.
func AddBar ¶
AddBar adds new bar to user. If primary keys already exist, this function returns *sheetdb.DuplicationError. If any fields are invalid, this function returns error.
func GetBar ¶
GetBar returns a bar by primary keys. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetBars ¶
func GetBars(userID int, opts ...BarQueryOption) ([]*Bar, error)
GetBars returns all bars that user has. If any options are specified, the result according to the specified option is returned. If there are no bar to return, this function returns an nil array. If the sort option is not specified, the order of bars is random.
type BarQuery ¶
type BarQuery struct {
// contains filtered or unexported fields
}
BarQuery is used for selecting bars.
type BarQueryOption ¶
BarQueryOption is an option to change the behavior of BarQuery.
type Foo ¶
type Foo struct { UserID int `json:"user_id" db:"primarykey"` FooID int `json:"foo_id" db:"primarykey"` Value float32 `json:"value"` Note string `json:"note" db:"allowempty"` }
Foo is a struct of foo which is a child of user.
func AddFoo ¶
AddFoo adds new foo to user. FooID is generated automatically. If any fields are invalid, this function returns error.
func GetFoo ¶
GetFoo returns a foo by primary keys. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetFoos ¶
func GetFoos(userID int, opts ...FooQueryOption) ([]*Foo, error)
GetFoos returns all foos that user has. If any options are specified, the result according to the specified option is returned. If there are no foo to return, this function returns an nil array. If the sort option is not specified, the order of foos is random.
func UpdateFoo ¶
UpdateFoo updates foo. If it can not be found, this function returns *sheetdb.NotFoundError. If any fields are invalid, this function returns error.
func (*Foo) AddFooChild ¶
AddFooChild adds new fooChild to foo. ChildID is generated automatically. If any fields are invalid, this method returns error.
func (*Foo) DeleteFooChild ¶
DeleteFooChild deletes fooChild from foo. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*Foo) GetFooChild ¶
GetFooChild returns a fooChild by ChildID. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*Foo) GetFooChildByValue ¶ added in v0.0.3
GetFooChildByValue returns a fooChild by Value. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*Foo) GetFooChildren ¶
func (m *Foo) GetFooChildren(opts ...FooChildQueryOption) ([]*FooChild, error)
GetFooChildren returns all fooChildren that foo has. If any options are specified, the result according to the specified option is returned. If there are no fooChild to return, this method returns an nil array. If the sort option is not specified, the order of fooChildren is random.
type FooChild ¶
type FooChild struct { UserID int `json:"user_id" db:"primarykey"` FooID int `json:"foo_id" db:"primarykey"` ChildID int `json:"child_id" db:"primarykey"` Value string `json:"value" db:"unique"` }
FooChild is a struct of foo child.
func AddFooChild ¶
AddFooChild adds new fooChild to foo. ChildID is generated automatically. If any fields are invalid, this function returns error.
func GetFooChild ¶
GetFooChild returns a fooChild by primary keys. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetFooChildByValue ¶
GetFooChildByValue returns a fooChild by Value. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetFooChildren ¶
func GetFooChildren(userID int, fooID int, opts ...FooChildQueryOption) ([]*FooChild, error)
GetFooChildren returns all fooChildren that foo has. If any options are specified, the result according to the specified option is returned. If there are no fooChild to return, this function returns an nil array. If the sort option is not specified, the order of fooChildren is random.
type FooChildQuery ¶
type FooChildQuery struct {
// contains filtered or unexported fields
}
FooChildQuery is used for selecting fooChildren.
type FooChildQueryOption ¶
type FooChildQueryOption func(query *FooChildQuery) *FooChildQuery
FooChildQueryOption is an option to change the behavior of FooChildQuery.
type FooQuery ¶
type FooQuery struct {
// contains filtered or unexported fields
}
FooQuery is used for selecting foos.
type FooQueryOption ¶
FooQueryOption is an option to change the behavior of FooQuery.
type TypeTest ¶
type TypeTest struct { ID int `json:"id" db:"primarykey"` StringValue string `json:"string_value"` BoolValue bool `json:"bool_value"` IntValue int `json:"int_value"` Int8Value int8 `json:"int8_value"` Int16Value int16 `json:"int16_value"` Int32Value int32 `json:"int32_value"` Int64Value int64 `json:"int64_value"` UintValue uint `json:"uint_value"` Uint8Value uint8 `json:"uint8_value"` Uint16Value uint16 `json:"uint16_value"` Uint32Value uint32 `json:"uint32_value"` Uint64Value uint64 `json:"uint64_value"` Float32Value float32 `json:"float32_value"` Float64Value float64 `json:"float64_value"` DateValue sheetdb.Date `json:"date_value"` DatetimeValue sheetdb.Datetime `json:"datetime_value"` CustomValue Sex `json:"custom_value"` PBoolValue *bool `json:"p_bool_value"` PIntValue *int `json:"p_int_value"` PInt8Value *int8 `json:"p_int8_value"` PInt16Value *int16 `json:"p_int16_value"` PInt32Value *int32 `json:"p_int32_value"` PInt64Value *int64 `json:"p_int64_value"` PUintValue *uint `json:"p_uint_value"` PUint8Value *uint8 `json:"p_uint8_value"` PUint16Value *uint16 `json:"p_uint16_value"` PUint32Value *uint32 `json:"p_uint32_value"` PUint64Value *uint64 `json:"p_uint64_value"` PFloat32Value *float32 `json:"p_float32_value"` PFloat64Value *float64 `json:"p_float64_value"` PDateValue *sheetdb.Date `json:"p_date_value"` PDatetimeValue *sheetdb.Datetime `json:"p_datetime_value"` PCustomValue *Sex `json:"p_custom_value"` }
TypeTest is a struct for type test.
func AddTypeTest ¶
func AddTypeTest(stringValue string, boolValue bool, intValue int, int8Value int8, int16Value int16, int32Value int32, int64Value int64, uintValue uint, uint8Value uint8, uint16Value uint16, uint32Value uint32, uint64Value uint64, float32Value float32, float64Value float64, dateValue sheetdb.Date, datetimeValue sheetdb.Datetime, customValue Sex, pBoolValue *bool, pIntValue *int, pInt8Value *int8, pInt16Value *int16, pInt32Value *int32, pInt64Value *int64, pUIntValue *uint, pUInt8Value *uint8, pUInt16Value *uint16, pUInt32Value *uint32, pUInt64Value *uint64, pFloat32Value *float32, pFloat64Value *float64, pDateValue *sheetdb.Date, pDatetimeValue *sheetdb.Datetime, pCustomValue *Sex) (*TypeTest, error)
AddTypeTest adds new typeTest. ID is generated automatically. If any fields are invalid, this function returns error.
func GetTypeTest ¶
GetTypeTest returns a typeTest by ID. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetTypeTests ¶
func GetTypeTests(opts ...TypeTestQueryOption) ([]*TypeTest, error)
GetTypeTests returns all typeTests. If any options are specified, the result according to the specified option is returned. If there are no typeTest to return, this function returns an nil array. If the sort option is not specified, the order of typeTests is random.
func UpdateTypeTest ¶
func UpdateTypeTest(id int, stringValue string, boolValue bool, intValue int, int8Value int8, int16Value int16, int32Value int32, int64Value int64, uintValue uint, uint8Value uint8, uint16Value uint16, uint32Value uint32, uint64Value uint64, float32Value float32, float64Value float64, dateValue sheetdb.Date, datetimeValue sheetdb.Datetime, customValue Sex, pBoolValue *bool, pIntValue *int, pInt8Value *int8, pInt16Value *int16, pInt32Value *int32, pInt64Value *int64, pUIntValue *uint, pUInt8Value *uint8, pUInt16Value *uint16, pUInt32Value *uint32, pUInt64Value *uint64, pFloat32Value *float32, pFloat64Value *float64, pDateValue *sheetdb.Date, pDatetimeValue *sheetdb.Datetime, pCustomValue *Sex) (*TypeTest, error)
UpdateTypeTest updates typeTest. If it can not be found, this function returns *sheetdb.NotFoundError. If any fields are invalid, this function returns error.
type TypeTestQuery ¶
type TypeTestQuery struct {
// contains filtered or unexported fields
}
TypeTestQuery is used for selecting typeTests.
type TypeTestQueryOption ¶
type TypeTestQueryOption func(query *TypeTestQuery) *TypeTestQuery
TypeTestQueryOption is an option to change the behavior of TypeTestQuery.
type User ¶
type User struct { UserID int `json:"user_id" db:"primarykey"` Name string `json:"name"` Email string `json:"email" db:"unique"` Sex Sex `json:"sex"` Birthday *sheetdb.Date `json:"birthday"` }
User is a struct of user.
func AddUser ¶
AddUser adds new user. UserID is generated automatically. If any fields are invalid, this function returns error.
func GetUser ¶
GetUser returns a user by UserID. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetUserByEmail ¶
GetUserByEmail returns a user by Email. If it can not be found, this function returns *sheetdb.NotFoundError.
func GetUsers ¶
func GetUsers(opts ...UserQueryOption) ([]*User, error)
GetUsers returns all users. If any options are specified, the result according to the specified option is returned. If there are no user to return, this function returns an nil array. If the sort option is not specified, the order of users is random.
func UpdateUser ¶
func UpdateUser(userID int, name string, email string, sex Sex, birthday *sheetdb.Date) (*User, error)
UpdateUser updates user. If it can not be found, this function returns *sheetdb.NotFoundError. If any fields are invalid, this function returns error.
func (*User) AddBar ¶
AddBar adds new bar to user. If argument 'datetime' already exists in this user, this method returns *sheetdb.DuplicationError. If any fields are invalid, this method returns error.
func (*User) AddFoo ¶
AddFoo adds new foo to user. FooID is generated automatically. If any fields are invalid, this method returns error.
func (*User) DeleteBar ¶
DeleteBar deletes bar from user. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*User) DeleteFoo ¶
DeleteFoo deletes foo and it's children fooChild from user. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*User) GetBar ¶
GetBar returns a bar by Datetime. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*User) GetBars ¶
func (m *User) GetBars(opts ...BarQueryOption) ([]*Bar, error)
GetBars returns all bars that user has. If any options are specified, the result according to the specified option is returned. If there are no bar to return, this method returns an nil array. If the sort option is not specified, the order of bars is random.
func (*User) GetFoo ¶
GetFoo returns a foo by FooID. If it can not be found, this method returns *sheetdb.NotFoundError.
func (*User) GetFoos ¶
func (m *User) GetFoos(opts ...FooQueryOption) ([]*Foo, error)
GetFoos returns all foos that user has. If any options are specified, the result according to the specified option is returned. If there are no foo to return, this method returns an nil array. If the sort option is not specified, the order of foos is random.
type UserQuery ¶
type UserQuery struct {
// contains filtered or unexported fields
}
UserQuery is used for selecting users.
type UserQueryOption ¶
UserQueryOption is an option to change the behavior of UserQuery.