Documentation ¶
Overview ¶
Package model contains the types for schema ...
Package model contains the types for schema ...
Index ¶
- Constants
- Variables
- func Bool(b bool) sql.NullBool
- func BoolPointer(b *bool) sql.NullBool
- func CountAllCountry(db XODB, queryArgs *CountryQueryArguments) (int, error)
- func DeleteCountryGraphQL(ctx context.Context, items []DeleteCountryInput) ([]graphql.ID, error)
- func Float64(i float64) sql.NullFloat64
- func Float64Pointer(i *float64) sql.NullFloat64
- func GetCountryMutations() string
- func GetCountryQueries() string
- func GetResolverAPIs(includeAPIs map[string]string, excludeAPIs []string) map[string]string
- func GetRootSchema(extraQueries, extraMutations, extraTypes string) string
- func Int64(i int64) sql.NullInt64
- func Int64Pointer(i *int64) sql.NullInt64
- func Log(ctx context.Context) logrus.FieldLogger
- 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 Country
- func CountryByCountryCode(db XODB, countryCode string) (*Country, error)
- func CountryByCountryName(db XODB, countryName string) (*Country, error)
- func CountryByID(db XODB, id int64) (*Country, error)
- func GetAllCountry(db XODB, queryArgs *CountryQueryArguments) ([]*Country, error)
- func GetMostRecentChangedCountry(db XODB, n int) ([]*Country, error)
- func GetMostRecentCountry(db XODB, n int) ([]*Country, error)
- type CountryConnectionResolver
- type CountryEdgeResolver
- type CountryFilter
- type CountryQueryArguments
- type CountryResolver
- func CountryByCountryCodeGraphQL(ctx context.Context, args struct{ ... }) (*CountryResolver, error)
- func CountryByCountryNameGraphQL(ctx context.Context, args struct{ ... }) (*CountryResolver, error)
- func CountryByIDGraphQL(ctx context.Context, args struct{ ... }) (*CountryResolver, error)
- func InsertCountryGraphQL(ctx context.Context, items []InsertCountryInput) ([]CountryResolver, error)
- func NewCountryResolver(node *Country) *CountryResolver
- func UpdateCountryGraphQL(ctx context.Context, items []UpdateCountryInput) ([]CountryResolver, error)
- func (r CountryResolver) ChangedDate() *graphql.Time
- func (r CountryResolver) CountryActive() *bool
- func (r CountryResolver) CountryBnum() *string
- func (r CountryResolver) CountryCode() string
- func (r CountryResolver) CountryLogo() *string
- func (r CountryResolver) CountryName() string
- func (r CountryResolver) CountryNum() *string
- func (r CountryResolver) CountrySnum() *string
- func (r CountryResolver) CreatedDate() *graphql.Time
- func (r CountryResolver) DeletedDate() *graphql.Time
- func (r CountryResolver) ID() graphql.ID
- type Cursor
- type DeleteCountryInput
- type InsertCountryInput
- type PageInfoResolver
- type RootResolver
- func (RootResolver) AllCountries(ctx context.Context, args *CountryQueryArguments) (*CountryConnectionResolver, error)
- func (RootResolver) CountryByCountryCode(ctx context.Context, args struct{ ... }) (*CountryResolver, error)
- func (RootResolver) CountryByCountryName(ctx context.Context, args struct{ ... }) (*CountryResolver, error)
- func (RootResolver) CountryByID(ctx context.Context, args struct{ ... }) (*CountryResolver, error)
- func (RootResolver) DeleteCountries(ctx context.Context, args struct{ ... }) ([]graphql.ID, error)
- func (RootResolver) InsertCountries(ctx context.Context, args struct{ ... }) ([]CountryResolver, error)
- func (RootResolver) UpdateCountries(ctx context.Context, args struct{ ... }) ([]CountryResolver, error)
- type ScannerValuer
- type Slice
- type StringSlice
- type UpdateCountryInput
- type Verifier
- type XODB
Constants ¶
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 GraphQLCountryAPIs = map[string]string{
"Countries": "This is a graphQL resource Countries, have GetAll, Get, Insert, Update, Delete actions.",
"Countries.CountryByCountryCode": "This is a graphQL resource Countries.CountryByCountryCode, only have NonPrimaryKeyGet action.",
"Countries.CountryByCountryName": "This is a graphQL resource Countries.CountryByCountryName, only have NonPrimaryKeyGet action.",
}
GraphQLCountryAPIs specifies the GraphQL APIs for Country
var GraphQLCountryTypes = `` /* 1474-byte string literal not displayed */
GraphQLCountryTypes specifies the GraphQL types for Country
var LogCtx = loggerContext{}
DBCtx is the key for setting DB Context.WithValue
var VerifierCtx = verifierContext{}
var XOLog = func(string, ...interface{}) {}
XOLog provides the log func used by generated queries.
Functions ¶
func BoolPointer ¶
BoolPointer converts bool pointer to sql.NullBool
func CountAllCountry ¶
func CountAllCountry(db XODB, queryArgs *CountryQueryArguments) (int, error)
CountAllCountry returns a count of all rows from 'country'
func DeleteCountryGraphQL ¶
func DeleteCountryGraphQL(ctx context.Context, items []DeleteCountryInput) ([]graphql.ID, error)
DeleteCountryGraphQL is the GraphQL end point for DeleteCountry
func Float64Pointer ¶
func Float64Pointer(i *float64) sql.NullFloat64
Float64Pointer converts a float64 pointer to sql.NullFloat64
func GetCountryMutations ¶
func GetCountryMutations() string
func GetCountryQueries ¶
func GetCountryQueries() string
func GetResolverAPIs ¶
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 Country ¶
type Country struct { ID int64 `json:"id" db:"id"` // id CountryName string `json:"country_name" db:"country_name"` // country_name CountryLogo sql.NullString `json:"country_logo" db:"country_logo"` // country_logo CountryActive sql.NullBool `json:"country_active" db:"country_active"` // country_active CountrySnum sql.NullInt64 `json:"country_snum" db:"country_snum"` // country_snum CountryNum sql.NullInt64 `json:"country_num" db:"country_num"` // country_num CountryBnum sql.NullInt64 `json:"country_bnum" db:"country_bnum"` // country_bnum CreatedDate pq.NullTime `json:"created_date" db:"created_date"` // created_date ChangedDate pq.NullTime `json:"changed_date" db:"changed_date"` // changed_date DeletedDate pq.NullTime `json:"deleted_date" db:"deleted_date"` // deleted_date CountryCode string `json:"country_code" db:"country_code"` // country_code // contains filtered or unexported fields }
Country represents a row from 'country'.
func CountryByCountryCode ¶
CountryByCountryCode retrieves a row from 'country' as a Country.
Generated from index 'country_country_code_key'.
func CountryByCountryName ¶
CountryByCountryName retrieves a row from 'country' as a Country.
Generated from index 'country_country_name_key'.
func CountryByID ¶
CountryByID retrieves a row from 'country' as a Country.
Generated from index 'country_pk'.
func GetAllCountry ¶
func GetAllCountry(db XODB, queryArgs *CountryQueryArguments) ([]*Country, error)
GetAllCountry returns all rows from 'country', based on the CountryQueryArguments. If the CountryQueryArguments is nil, it will use the default CountryQueryArguments instead.
func GetMostRecentChangedCountry ¶
GetMostRecentChangedCountry returns n most recent rows from 'country', ordered by "changed_date" in descending order.
func GetMostRecentCountry ¶
GetMostRecentCountry returns n most recent rows from 'country', ordered by "created_date" in descending order.
func (*Country) Deleted ¶
Deleted provides information if the Country has been deleted from the database.
type CountryConnectionResolver ¶
type CountryConnectionResolver struct {
// contains filtered or unexported fields
}
CountryConnectionResolver defines a GraphQL resolver for CountryConnection
func AllCountries ¶
func AllCountries(ctx context.Context, queryArgs *CountryQueryArguments) (*CountryConnectionResolver, error)
AllCountries is the GraphQL end point for GetAllCountry
func NewCountryConnectionResolver ¶
func NewCountryConnectionResolver(data []*Country, count int) *CountryConnectionResolver
func (CountryConnectionResolver) Countries ¶
func (r CountryConnectionResolver) Countries() *[]*CountryResolver
Countries returns the list of Country
func (CountryConnectionResolver) Edges ¶
func (r CountryConnectionResolver) Edges() *[]*CountryEdgeResolver
Edges returns standard GraphQL edges
func (CountryConnectionResolver) PageInfo ¶
func (r CountryConnectionResolver) PageInfo() *PageInfoResolver
PageInfo returns PageInfo
func (CountryConnectionResolver) TotalCount ¶
func (r CountryConnectionResolver) TotalCount() *int32
TotalCount returns total count
type CountryEdgeResolver ¶
type CountryEdgeResolver struct {
// contains filtered or unexported fields
}
CountryEdgeResolver defines the Country edge
func (CountryEdgeResolver) Cursor ¶
func (r CountryEdgeResolver) Cursor() graphql.ID
Cursor returns the cursor
func (CountryEdgeResolver) Node ¶
func (r CountryEdgeResolver) Node() *CountryResolver
Node returns the Country node
type CountryFilter ¶
type CountryFilter struct { Conjunction *string // enum in "AND", "OR", nil(consider as single condition) CountryName *string `json:"countryName"` // equal to CountryName CountryNameLike *string `json:"countryName_like"` // LIKE CountryNameILike *string `json:"countryName_ilike"` // ILIKE case-insensitive CountryNameNLike *string `json:"countryName_nlike"` // NOT LIKE CountryNameNILike *string `json:"countryName_nilike"` // NOT ILIKE case-insensitive CountryCode *string `json:"countryCode"` // equal to CountryCode CountryCodeLike *string `json:"countryCode_like"` // LIKE CountryCodeILike *string `json:"countryCode_ilike"` // ILIKE case-insensitive CountryCodeNLike *string `json:"countryCode_nlike"` // NOT LIKE CountryCodeNILike *string `json:"countryCode_nilike"` // NOT ILIKE case-insensitive }
CountryFilter related to CountryQueryArguments struct field name contain table column name in Camel style and logic operator(lt, gt etc) only indexed column and special column defined in ExtraFilters declared in file extra_rules.yaml
type CountryQueryArguments ¶
type CountryQueryArguments struct { Cursor Where *CountryFilter // contains filtered or unexported fields }
CountryQueryArguments composed by Cursor, CountryFilter and sql filter string
func ApplyCountryQueryArgsDefaults ¶
func ApplyCountryQueryArgsDefaults(queryArgs *CountryQueryArguments) *CountryQueryArguments
ApplyCountryQueryArgsDefaults assigns default cursor values to non-nil fields.
type CountryResolver ¶
type CountryResolver struct {
// contains filtered or unexported fields
}
CountryResolver defines the GraphQL resolver for 'Country'.
func CountryByCountryCodeGraphQL ¶
func CountryByCountryCodeGraphQL(ctx context.Context, args struct { CountryCode string }) (*CountryResolver, error)
CountryByCountryCodeGraphQL retrieves a row from 'country' as a Country.
Generated from index 'country_country_code_key'.
func CountryByCountryNameGraphQL ¶
func CountryByCountryNameGraphQL(ctx context.Context, args struct { CountryName string }) (*CountryResolver, error)
CountryByCountryNameGraphQL retrieves a row from 'country' as a Country.
Generated from index 'country_country_name_key'.
func CountryByIDGraphQL ¶
func CountryByIDGraphQL(ctx context.Context, args struct { ID graphql.ID }) (*CountryResolver, error)
CountryByIDGraphQL retrieves a row from 'country' as a Country.
Generated from index 'country_pk'.
func InsertCountryGraphQL ¶
func InsertCountryGraphQL(ctx context.Context, items []InsertCountryInput) ([]CountryResolver, error)
InsertCountryGraphQL is the GraphQL end point for InsertCountry
func NewCountryResolver ¶
func NewCountryResolver(node *Country) *CountryResolver
func UpdateCountryGraphQL ¶
func UpdateCountryGraphQL(ctx context.Context, items []UpdateCountryInput) ([]CountryResolver, error)
UpdateCountryGraphQL is the GraphQL end point for UpdateCountry
func (CountryResolver) ChangedDate ¶
func (r CountryResolver) ChangedDate() *graphql.Time
func (CountryResolver) CountryActive ¶
func (r CountryResolver) CountryActive() *bool
func (CountryResolver) CountryBnum ¶
func (r CountryResolver) CountryBnum() *string
func (CountryResolver) CountryCode ¶
func (r CountryResolver) CountryCode() string
func (CountryResolver) CountryLogo ¶
func (r CountryResolver) CountryLogo() *string
func (CountryResolver) CountryName ¶
func (r CountryResolver) CountryName() string
func (CountryResolver) CountryNum ¶
func (r CountryResolver) CountryNum() *string
func (CountryResolver) CountrySnum ¶
func (r CountryResolver) CountrySnum() *string
func (CountryResolver) CreatedDate ¶
func (r CountryResolver) CreatedDate() *graphql.Time
func (CountryResolver) DeletedDate ¶
func (r CountryResolver) DeletedDate() *graphql.Time
func (CountryResolver) ID ¶
func (r CountryResolver) 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 DeleteCountryInput ¶
type DeleteCountryInput struct {
ID graphql.ID
}
DeleteCountryInput defines the delete Country mutation input
type InsertCountryInput ¶
type InsertCountryInput struct { CountryName string CountryLogo *string CountryActive *bool CountrySnum *string CountryNum *string CountryBnum *string CreatedDate *graphql.Time ChangedDate *graphql.Time DeletedDate *graphql.Time CountryCode string }
InsertCountryInput defines the insert Country 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) AllCountries ¶
func (RootResolver) AllCountries(ctx context.Context, args *CountryQueryArguments) (*CountryConnectionResolver, error)
func (RootResolver) CountryByCountryCode ¶
func (RootResolver) CountryByCountryCode(ctx context.Context, args struct { CountryCode string }) (*CountryResolver, error)
CountryByCountryCode generated by country_country_code_key
func (RootResolver) CountryByCountryName ¶
func (RootResolver) CountryByCountryName(ctx context.Context, args struct { CountryName string }) (*CountryResolver, error)
CountryByCountryName generated by country_country_name_key
func (RootResolver) CountryByID ¶
func (RootResolver) CountryByID(ctx context.Context, args struct { ID graphql.ID }) (*CountryResolver, error)
CountryByID generated by country_pk
func (RootResolver) DeleteCountries ¶
func (RootResolver) DeleteCountries(ctx context.Context, args struct{ Input []DeleteCountryInput }) ([]graphql.ID, error)
func (RootResolver) InsertCountries ¶
func (RootResolver) InsertCountries(ctx context.Context, args struct{ Input []InsertCountryInput }) ([]CountryResolver, error)
func (RootResolver) UpdateCountries ¶
func (RootResolver) UpdateCountries(ctx context.Context, args struct{ Input []UpdateCountryInput }) ([]CountryResolver, 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 UpdateCountryInput ¶
type UpdateCountryInput struct { ID graphql.ID CountryName *string CountryLogo *string CountryActive *bool CountrySnum *string CountryNum *string CountryBnum *string CreatedDate *graphql.Time ChangedDate *graphql.Time DeletedDate *graphql.Time CountryCode *string // contains filtered or unexported fields }
UpdateCountryInput defines the update Country 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 'public'.
This should work with database/sql.DB and database/sql.Tx.