Versions in this module Expand all Collapse all v1 v1.0.1 Jul 4, 2022 v1.0.0 Jun 27, 2022 Changes in this version + const AnyLike + const ContainAll + const ContainAny + const Equal + const EqualTo + const GreaterEqual + const GreaterThan + const In + const IsArray + const IsObject + const IsType + const LessEqual + const LessThan + const Like + const MatchAgainst + const NotEqual + const NotIn + const NotLike + const ReadLock + const WriteLock + var ErrInvalidCursor = fmt.Errorf("goloquent: invalid cursor") + var ErrNoSuchEntity = fmt.Errorf("goloquent: entity not found") + func LoadStruct(src interface{}, data map[string]interface{}) error + func ParseKey(str string) (*datastore.Key, error) + func RegisterDialect(driver string, d Dialect) + func SaveStruct(src interface{}) (map[string]Property, error) + func SetPKSimple(flag bool) + func StringKey(key *datastore.Key) string + func StringifyKey(key *datastore.Key) string + type CharSet struct + Collation string + Encoding string + type Client struct + func (c Client) Exec(query string, args ...interface{}) (sql.Result, error) + func (c Client) PrepareExec(query string, args ...interface{}) (sql.Result, error) + func (c Client) Query(query string, args ...interface{}) (*sql.Rows, error) + func (c Client) QueryRow(query string, args ...interface{}) *sql.Row + type Column struct + func (c Column) Name() string + type Config struct + CharSet *CharSet + Database string + Host string + Logger LogHandler + Password string + Port string + TLSConfig string + UnixSocket string + Username string + func (c *Config) Normalize() + type Cursor struct + Key *datastore.Key + Signature string + func DecodeCursor(c string) (Cursor, error) + func (c Cursor) String() string + type DB struct + func NewDB(driver string, charset CharSet, conn sqlCommon, dialect Dialect, ...) *DB + func (db *DB) Ancestor(ancestor *datastore.Key) *Query + func (db *DB) AnyOfAncestor(ancestors ...*datastore.Key) *Query + func (db *DB) Close() error + func (db *DB) Create(ctx context.Context, model interface{}, parentKey ...*datastore.Key) error + func (db *DB) Delete(ctx context.Context, model interface{}) error + func (db *DB) Destroy(ctx context.Context, model interface{}) error + func (db *DB) Exec(stmt string, args ...interface{}) (sql.Result, error) + func (db *DB) Find(ctx context.Context, key *datastore.Key, model interface{}) error + func (db *DB) First(ctx context.Context, model interface{}) error + func (db *DB) Get(ctx context.Context, model interface{}) error + func (db *DB) MatchAgainst(fields []string, value ...string) *Query + func (db *DB) Migrate(ctx context.Context, model ...interface{}) error + func (db *DB) NewQuery() *Query + func (db *DB) Omit(fields ...string) Replacer + func (db *DB) Paginate(ctx context.Context, p *Pagination, model interface{}) error + func (db *DB) Query(stmt string, args ...interface{}) (*sql.Rows, error) + func (db *DB) RunInTransaction(cb TransactionHandler) error + func (db *DB) Save(ctx context.Context, model interface{}) error + func (db *DB) Select(fields ...string) *Query + func (db *DB) Table(name string) *Table + func (db *DB) Truncate(ctx context.Context, model ...interface{}) error + func (db *DB) Upsert(ctx context.Context, model interface{}, parentKey ...*datastore.Key) error + func (db *DB) Where(field string, operator string, value interface{}) *Query + func (db DB) ID() string + func (db DB) Name() string + type Date time.Time + func (d *Date) UnmarshalJSON(b []byte) error + func (d *Date) UnmarshalText(b []byte) error + func (d Date) MarshalJSON() ([]byte, error) + func (d Date) MarshalText() ([]byte, error) + func (d Date) String() string + type DefaultEncoder struct + type DefaultStmtEncoder struct + type Dialect interface + AlterTable func(ctx context.Context, tb string, cols []Column, unsafe bool) error + Bind func(i uint) string + CreateTable func(ctx context.Context, tb string, cols []Column) error + CurrentDB func() (n string) + DataType func(s Schema) string + FilterJSON func(f Filter) (s string, args []interface{}, err error) + GetColumns func(tb string) (cols []string) + GetIndexes func(tb string) (idxs []string) + GetSchema func(c Column) []Schema + GetTable func(ns string) string + HasIndex func(tb, idx string) bool + HasTable func(tb string) bool + JSONMarshal func(i interface{}) (b json.RawMessage) + OnConflictUpdate func(tb string, cols []string) string + Open func(c Config) (*sql.DB, error) + Quote func(n string) string + ReplaceInto func(ctx context.Context, src, dst string) error + SetDB func(db Client) + UpdateWithLimit func() bool + Value func(v interface{}) string + Version func() (ver string) + func GetDialect(driver string) (d Dialect, isValid bool) + type Filter struct + func (f *Filter) Interface() (interface{}, error) + func (f Filter) Field() string + func (f Filter) IsJSON() bool + func (f Filter) JSON() *JSON + type Iterator struct + func (it *Iterator) Cursor() (Cursor, error) + func (it *Iterator) First() *Iterator + func (it *Iterator) Last() *Iterator + func (it *Iterator) Next() bool + func (it *Iterator) Scan(ctx context.Context, src interface{}) error + func (it Iterator) Count() uint + func (it Iterator) Get(k string) []byte + type JSON struct + type Loader interface + Load func(context.Context) error + type LogHandler func(context.Context, *Stmt) + type NativeHandler func(*sql.DB) + type OmitDefault interface + type Pagination struct + Cursor string + Limit uint + func (p *Pagination) Count() uint + func (p *Pagination) NextCursor() string + func (p *Pagination) Reset() + func (p *Pagination) SetQuery(q *Query) + type Property struct + Value interface{} + func (p Property) Interface() (interface{}, error) + func (p Property) Name() string + type Query struct + func (q *Query) Ancestor(ancestor *datastore.Key) *Query + func (q *Query) AnyOfAncestor(ancestors ...*datastore.Key) *Query + func (q *Query) DistinctOn(fields ...string) *Query + func (q *Query) Find(ctx context.Context, key *datastore.Key, model interface{}) error + func (q *Query) First(ctx context.Context, model interface{}) error + func (q *Query) Flush(ctx context.Context) error + func (q *Query) Get(ctx context.Context, model interface{}) error + func (q *Query) InsertInto(ctx context.Context, table string) error + func (q *Query) Limit(limit int) *Query + func (q *Query) Lock(mode locked) *Query + func (q *Query) MatchAgainst(fields []string, values ...string) *Query + func (q *Query) Offset(offset int) *Query + func (q *Query) Omit(fields ...string) *Query + func (q *Query) OrderBy(values ...interface{}) *Query + func (q *Query) Paginate(ctx context.Context, p *Pagination, model interface{}) error + func (q *Query) RLock() *Query + func (q *Query) ReplaceInto(ctx context.Context, table string) error + func (q *Query) Scan(ctx context.Context, dest ...interface{}) error + func (q *Query) Select(fields ...string) *Query + func (q *Query) Unscoped() *Query + func (q *Query) Update(ctx context.Context, v interface{}) error + func (q *Query) WLock() *Query + func (q *Query) Where(field string, op string, value interface{}) *Query + func (q *Query) WhereAnyLike(field string, v interface{}) *Query + func (q *Query) WhereEqual(field string, v interface{}) *Query + func (q *Query) WhereIn(field string, v interface{}) *Query + func (q *Query) WhereJSON(field, op string, v interface{}) *Query + func (q *Query) WhereJSONContainAny(field string, v interface{}) *Query + func (q *Query) WhereJSONEqual(field string, v interface{}) *Query + func (q *Query) WhereJSONIn(field string, v []interface{}) *Query + func (q *Query) WhereJSONIsArray(field string) *Query + func (q *Query) WhereJSONIsObject(field string) *Query + func (q *Query) WhereJSONNotEqual(field string, v interface{}) *Query + func (q *Query) WhereJSONNotIn(field string, v []interface{}) *Query + func (q *Query) WhereJSONType(field, typ string) *Query + func (q *Query) WhereLike(field, v string) *Query + func (q *Query) WhereNotEqual(field string, v interface{}) *Query + func (q *Query) WhereNotIn(field string, v interface{}) *Query + func (q *Query) WhereNotLike(field, v string) *Query + func (q *Query) WhereNotNull(field string) *Query + func (q *Query) WhereNull(field string) *Query + type QueryBuilder struct + type Registry struct + func NewRegistry() *Registry + func (r *Registry) EncodeValue(v reflect.Value) (interface{}, error) + func (r *Registry) SetDefaultEncoders() + func (r *Registry) SetKindEncoder(k reflect.Kind, f encodeFunc) + func (r *Registry) SetTypeEncoder(t reflect.Type, f encodeFunc) + type Replacer interface + Save func(ctx context.Context, model interface{}) error + Upsert func(ctx context.Context, model interface{}, k ...*datastore.Key) error + type Saver interface + Save func(context.Context) error + type Schema struct + DataType string + DefaultValue interface{} + IsIndexed bool + IsNullable bool + IsUnsigned bool + Name string + func (s Schema) IsOmitEmpty() bool + type SoftDelete *time.Time + type Stmt struct + Result sql.Result + func (s *Stmt) Raw() string + func (s *Stmt) String() string + func (s Stmt) Arguments() []interface{} + func (s Stmt) TimeElapse() time.Duration + type StmtRegistry struct + func NewStmtRegistry() *StmtRegistry + func (r *StmtRegistry) BuildStatement(w Writer, v reflect.Value) ([]interface{}, error) + func (r *StmtRegistry) SetDefaultEncoders() + func (r *StmtRegistry) SetKindEncoder(k reflect.Kind, f writerFunc) + func (r *StmtRegistry) SetTypeEncoder(t reflect.Type, f writerFunc) + type StructCodec struct + type Table struct + func (t *Table) AddIndex(ctx context.Context, fields ...string) error + func (t *Table) AddUniqueIndex(ctx context.Context, fields ...string) error + func (t *Table) Ancestor(ancestor *datastore.Key) *Query + func (t *Table) AnyOfAncestor(ancestors ...*datastore.Key) *Query + func (t *Table) Create(ctx context.Context, model interface{}, parentKey ...*datastore.Key) error + func (t *Table) DistinctOn(fields ...string) *Query + func (t *Table) DropIfExists(ctx context.Context) error + func (t *Table) Exists() bool + func (t *Table) Find(ctx context.Context, key *datastore.Key, model interface{}) error + func (t *Table) First(ctx context.Context, model interface{}) error + func (t *Table) Get(ctx context.Context, model interface{}) error + func (t *Table) InsertInto(ctx context.Context, table string) error + func (t *Table) Limit(limit int) *Query + func (t *Table) Lock(mode locked) *Query + func (t *Table) Migrate(ctx context.Context, model interface{}) error + func (t *Table) Offset(offset int) *Query + func (t *Table) Omit(fields ...string) *Query + func (t *Table) OrderBy(fields ...interface{}) *Query + func (t *Table) Paginate(ctx context.Context, p *Pagination, model interface{}) error + func (t *Table) RLock() *Query + func (t *Table) ReplaceInto(ctx context.Context, table string) error + func (t *Table) Save(ctx context.Context, model interface{}) error + func (t *Table) Scan(ctx context.Context, dest ...interface{}) error + func (t *Table) Select(fields ...string) *Query + func (t *Table) Truncate(ctx context.Context) error + func (t *Table) Unscoped() *Query + func (t *Table) Update(ctx context.Context, v interface{}) error + func (t *Table) Upsert(ctx context.Context, model interface{}, parentKey ...*datastore.Key) error + func (t *Table) WLock() *Query + func (t *Table) Where(field, op string, value interface{}) *Query + func (t *Table) WhereEqual(field string, v interface{}) *Query + func (t *Table) WhereIn(field string, v []interface{}) *Query + func (t *Table) WhereJSONEqual(field string, v interface{}) *Query + func (t *Table) WhereLike(field, v string) *Query + func (t *Table) WhereNotEqual(field string, v interface{}) *Query + func (t *Table) WhereNotIn(field string, v []interface{}) *Query + func (t *Table) WhereNotLike(field, v string) *Query + func (t *Table) WhereNotNull(field string) *Query + func (t *Table) WhereNull(field string) *Query + type TransactionHandler func(*DB) error + type Writer interface