Documentation ¶
Overview ¶
Package models contains the types for schema 'luoji'.
Package models contains the types for schema 'luoji'.
Index ¶
- Constants
- Variables
- func AccountsByBalanceGraphQL(ctx context.Context, args struct{ ... }) (*[]AccountResolver, error)
- func Bool(b bool) sql.NullBool
- func BoolPointer(b *bool) sql.NullBool
- func CountAllAccount(db XODB, queryArgs *AccountQueryArguments) (int, error)
- func DeleteAccountGraphQL(ctx context.Context, items []DeleteAccountInput) ([]graphql.ID, error)
- func Float64(i float64) sql.NullFloat64
- func Float64Pointer(i *float64) sql.NullFloat64
- func GetAccountMutations() string
- func GetAccountQueries() string
- func GetRootSchema(extraQueries, extraMutations, extraTypes string) string
- func Int64(i int64) sql.NullInt64
- func Int64Pointer(i *int64) sql.NullInt64
- func PointerBool(b sql.NullBool) *bool
- func PointerFloat64(i sql.NullFloat64) *float64
- func PointerFloat64SqlFloat64(i sql.NullFloat64) *float64
- func PointerGqlTime(t pq.NullTime) *graphql.Time
- func PointerInt64(i sql.NullInt64) *int64
- func PointerString(s sql.NullString) *string
- func PointerStringFloat64(i *float64) *string
- func PointerStringInt64(i *int64) *string
- func PointerStringSqlInt64(i sql.NullInt64) *string
- func PointerTime(t pq.NullTime) *time.Time
- func String(s string) sql.NullString
- func StringPointer(s *string) sql.NullString
- func Time(t time.Time) pq.NullTime
- func TimeGqlPointer(t *graphql.Time) pq.NullTime
- func TimePointer(t *time.Time) pq.NullTime
- type Account
- func AccountByID(db XODB, id int64) (*Account, error)
- func AccountsByBalance(db XODB, balance sql.NullFloat64) ([]*Account, error)
- func GetAllAccount(db XODB, queryArgs *AccountQueryArguments) ([]*Account, error)
- func GetMostRecentAccount(db XODB, n int) ([]*Account, error)
- func GetMostRecentChangedAccount(db XODB, n int) ([]*Account, error)
- type AccountConnectionResolver
- type AccountEdgeResolver
- type AccountFilter
- type AccountQueryArguments
- type AccountResolver
- func AccountByIDGraphQL(ctx context.Context, args struct{ ... }) (*AccountResolver, error)
- func InsertAccountGraphQL(ctx context.Context, items []InsertAccountInput) ([]AccountResolver, error)
- func NewAccountResolver(node *Account) *AccountResolver
- func UpdateAccountGraphQL(ctx context.Context, items []UpdateAccountInput) ([]AccountResolver, error)
- type Cursor
- type DeleteAccountInput
- type InsertAccountInput
- type PageInfoResolver
- type RootResolver
- func (RootResolver) AccountByID(ctx context.Context, args struct{ ... }) (*AccountResolver, error)
- func (RootResolver) AccountsByBalance(ctx context.Context, args struct{ ... }) (*[]AccountResolver, error)
- func (RootResolver) AllAccounts(ctx context.Context, args *AccountQueryArguments) (*AccountConnectionResolver, error)
- func (RootResolver) DeleteAccounts(ctx context.Context, args struct{ ... }) ([]graphql.ID, error)
- func (RootResolver) InsertAccounts(ctx context.Context, args struct{ ... }) ([]AccountResolver, error)
- func (RootResolver) UpdateAccounts(ctx context.Context, args struct{ ... }) ([]AccountResolver, error)
- type ScannerValuer
- type Slice
- type StringSlice
- type UpdateAccountInput
- type XODB
Constants ¶
const GraphQLAccountTypes = `` /* 525-byte string literal not displayed */
GraphQLAccountTypes specifies the GraphQL types for Account
const GraphQLCommonTypes = `` /* 159-byte string literal not displayed */
GraphQL related types
Variables ¶
var DBCtx = dbContext{}
DBCtx is the key for setting DB Context.WithValue
var DefaultCursor = Cursor{
Offset: &defaultOffset,
Limit: &defaultLimit,
Index: &defaultIndex,
Desc: &defaultDesc,
Dead: &defaultDead,
}
DefaultCursor will get the 50 first non-deleted IDs from a table.
var XOLog = func(string, ...interface{}) {}
XOLog provides the log func used by generated queries.
Functions ¶
func AccountsByBalanceGraphQL ¶
func AccountsByBalanceGraphQL(ctx context.Context, args struct { Balance *float64 }) (*[]AccountResolver, error)
AccountsByBalanceGraphQL retrieves a row from 'accounts' as a Account.
Generated from index 'balance_idx'.
func BoolPointer ¶
BoolPointer converts bool pointer to sql.NullBool
func CountAllAccount ¶
func CountAllAccount(db XODB, queryArgs *AccountQueryArguments) (int, error)
CountAllAccount returns a count of all rows from 'luoji.accounts'
func DeleteAccountGraphQL ¶
DeleteAccountGraphQL is the GraphQL end point for DeleteAccount
func Float64Pointer ¶
func Float64Pointer(i *float64) sql.NullFloat64
Float64Pointer converts a float64 pointer to sql.NullFloat64
func GetAccountMutations ¶
func GetAccountMutations() string
func GetAccountQueries ¶
func GetAccountQueries() string
func GetRootSchema ¶
func Int64Pointer ¶
Int64Pointer converts a int64 pointer to sql.NullInt64
func PointerBool ¶
PointerBool converts bool to pointer to bool
func PointerFloat64 ¶
func PointerFloat64(i sql.NullFloat64) *float64
PointerFloat64 converts sql.NullFloat64 to pointer to float64
func PointerFloat64SqlFloat64 ¶
func PointerFloat64SqlFloat64(i sql.NullFloat64) *float64
PointerFloat64SqlFloat64 converts sql.NullFloat64 pointer to graphql.ID pointer
func PointerGqlTime ¶
PointerGqlTime converts pq.NullType to pointer to graphql.Time
func PointerInt64 ¶
PointerInt64 converts sql.NullInt64 to pointer to int64
func PointerString ¶
func PointerString(s sql.NullString) *string
PointerString converts sql.NullString to pointer to string
func PointerStringFloat64 ¶
PointerStringFloat64 converts Float64 pointer to string pointer
func PointerStringInt64 ¶
PointerStringInt64 converts Int64 pointer to string pointer
func PointerStringSqlInt64 ¶
PointerStringSqlInt64 converts sql.NullInt64 pointer to graphql.ID pointer
func PointerTime ¶
PointerTime converts pq.NullTIme to pointer to time.Time
func StringPointer ¶
func StringPointer(s *string) sql.NullString
StringPointer converts string pointer to sql.NullString
func TimeGqlPointer ¶
TimeGqlPointer converts graphql.Time pointer to pq.NullTime
Types ¶
type Account ¶
type Account struct { ID int64 `json:"id" db:"id"` // id Balance sql.NullFloat64 `json:"balance" db:"balance"` // balance // contains filtered or unexported fields }
Account represents a row from 'accounts'.
func AccountByID ¶
AccountByID retrieves a row from 'accounts' as a Account.
Generated from index 'primary'.
func AccountsByBalance ¶
func AccountsByBalance(db XODB, balance sql.NullFloat64) ([]*Account, error)
AccountsByBalance retrieves a row from 'accounts' as a Account.
Generated from index 'balance_idx'.
func GetAllAccount ¶
func GetAllAccount(db XODB, queryArgs *AccountQueryArguments) ([]*Account, error)
GetAllAccount returns all rows from 'luoji.accounts', based on the AccountQueryArguments. If the AccountQueryArguments is nil, it will use the default AccountQueryArguments instead.
func GetMostRecentAccount ¶
GetMostRecentAccount returns n most recent rows from 'luoji.accounts', ordered by "created_date" in descending order.
func GetMostRecentChangedAccount ¶
GetMostRecentChangedAccount returns n most recent rows from 'luoji.accounts', ordered by "changed_date" in descending order.
func (*Account) Deleted ¶
Deleted provides information if the Account has been deleted from the database.
type AccountConnectionResolver ¶
type AccountConnectionResolver struct {
// contains filtered or unexported fields
}
AccountConnectionResolver defines a GraphQL resolver for AccountConnection
func AllAccounts ¶
func AllAccounts(ctx context.Context, queryArgs *AccountQueryArguments) (*AccountConnectionResolver, error)
AllAccounts is the GraphQL end point for GetAllAccount
func (AccountConnectionResolver) Accounts ¶
func (r AccountConnectionResolver) Accounts() *[]*AccountResolver
Accounts returns the list of Account
func (AccountConnectionResolver) Edges ¶
func (r AccountConnectionResolver) Edges() *[]*AccountEdgeResolver
Edges returns standard GraphQL edges
func (AccountConnectionResolver) PageInfo ¶
func (r AccountConnectionResolver) PageInfo() *PageInfoResolver
PageInfo returns PageInfo
func (AccountConnectionResolver) TotalCount ¶
func (r AccountConnectionResolver) TotalCount() *int32
TotalCount returns total count
type AccountEdgeResolver ¶
type AccountEdgeResolver struct {
// contains filtered or unexported fields
}
AccountEdgeResolver defines the Account edge
func (AccountEdgeResolver) Cursor ¶
func (r AccountEdgeResolver) Cursor() graphql.ID
Cursor returns the cursor
func (AccountEdgeResolver) Node ¶
func (r AccountEdgeResolver) Node() *AccountResolver
Node returns the Account node
type AccountFilter ¶
type AccountFilter struct { Conjunction *string // enum in "AND", "OR", nil(consider as single condition) Balance *float64 `json:"balance"` // equal to Balance BalanceLt *float64 `json:"balance_lt"` // less than Balance BalanceLte *float64 `json:"balance_lte"` // less than and equal to Balance BalanceGt *float64 `json:"balance_gt"` // greater than Balance BalanceGte *float64 `json:"balance_gte"` // greater than and equal to Balance }
AccountFilter related to AccountQueryArguments struct field name contain table column name in Camel style and logic operator(lt, gt etc) only indexed column and special column defined in sqlSpecColFilterCtlMap declared in file xo/internal/funcs.go
type AccountQueryArguments ¶
type AccountQueryArguments struct { Cursor Where *AccountFilter // contains filtered or unexported fields }
AccountQueryArguments composed by Cursor, AccountFilter and sql filter string
func ApplyAccountQueryArgsDefaults ¶
func ApplyAccountQueryArgsDefaults(queryArgs *AccountQueryArguments) *AccountQueryArguments
ApplyAccountQueryArgsDefaults assigns default cursor values to non-nil fields.
type AccountResolver ¶
type AccountResolver struct {
// contains filtered or unexported fields
}
AccountResolver defines the GraphQL resolver for 'Account'.
func AccountByIDGraphQL ¶
func AccountByIDGraphQL(ctx context.Context, args struct { ID graphql.ID }) (*AccountResolver, error)
AccountByIDGraphQL retrieves a row from 'accounts' as a Account.
Generated from index 'primary'.
func InsertAccountGraphQL ¶
func InsertAccountGraphQL(ctx context.Context, items []InsertAccountInput) ([]AccountResolver, error)
InsertAccountGraphQL is the GraphQL end point for InsertAccount
func NewAccountResolver ¶
func NewAccountResolver(node *Account) *AccountResolver
func UpdateAccountGraphQL ¶
func UpdateAccountGraphQL(ctx context.Context, items []UpdateAccountInput) ([]AccountResolver, error)
UpdateAccountGraphQL is the GraphQL end point for UpdateAccount
func (AccountResolver) Balance ¶
func (r AccountResolver) Balance() *float64
func (AccountResolver) ID ¶
func (r AccountResolver) ID() graphql.ID
type Cursor ¶
type Cursor struct { Offset *int32 Limit *int32 Index *string Desc *bool Dead *bool After *graphql.ID First *int32 Before *graphql.ID Last *int32 }
Cursor specifies an index to sort by, the direction of the sort, an offset, and a limit.
type DeleteAccountInput ¶
DeleteAccountInput defines the delete Account mutation input
type InsertAccountInput ¶
type InsertAccountInput struct {
Balance *float64
}
InsertAccountInput defines the insert Account mutation input
type PageInfoResolver ¶
type PageInfoResolver struct {
// contains filtered or unexported fields
}
PageInfoResolver defines the GraphQL PageInfo type
func (PageInfoResolver) EndCursor ¶
func (r PageInfoResolver) EndCursor() *graphql.ID
EndCursor returns the end cursor (global id)
func (PageInfoResolver) HasNextPage ¶
func (r PageInfoResolver) HasNextPage() bool
HasNextPage returns if next page is available
func (PageInfoResolver) HasPreviousPage ¶
func (r PageInfoResolver) HasPreviousPage() bool
HasPreviousPage returns if previous page is available
func (PageInfoResolver) StartCursor ¶
func (r PageInfoResolver) StartCursor() *graphql.ID
StartCursor returns the start cursor (global id)
type RootResolver ¶
type RootResolver struct{}
func (RootResolver) AccountByID ¶
func (RootResolver) AccountByID(ctx context.Context, args struct { ID graphql.ID }) (*AccountResolver, error)
AccountByID generated by primary
func (RootResolver) AccountsByBalance ¶
func (RootResolver) AccountsByBalance(ctx context.Context, args struct { Balance *float64 }) (*[]AccountResolver, error)
AccountsByBalance generated by balance_idx
func (RootResolver) AllAccounts ¶
func (RootResolver) AllAccounts(ctx context.Context, args *AccountQueryArguments) (*AccountConnectionResolver, error)
func (RootResolver) DeleteAccounts ¶
func (RootResolver) DeleteAccounts(ctx context.Context, args struct{ Input []DeleteAccountInput }) ([]graphql.ID, error)
func (RootResolver) InsertAccounts ¶
func (RootResolver) InsertAccounts(ctx context.Context, args struct{ Input []InsertAccountInput }) ([]AccountResolver, error)
func (RootResolver) UpdateAccounts ¶
func (RootResolver) UpdateAccounts(ctx context.Context, args struct{ Input []UpdateAccountInput }) ([]AccountResolver, error)
type ScannerValuer ¶
ScannerValuer is the common interface for types that implement both the database/sql.Scanner and sql/driver.Valuer interfaces.
type StringSlice ¶
type StringSlice []string
StringSlice is a slice of strings.
func (*StringSlice) Scan ¶
func (ss *StringSlice) Scan(src interface{}) error
Scan satisfies the sql.Scanner interface for StringSlice.
type UpdateAccountInput ¶
UpdateAccountInput defines the update Account mutation input
type XODB ¶
type XODB interface { Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row }
XODB is the common interface for database operations that can be used with types from schema 'luoji'.
This should work with database/sql.DB and database/sql.Tx.