Versions in this module Expand all Collapse all v2 v2.7.3 May 17, 2025 v2.7.2 May 17, 2025 Changes in this version + func AreValuesEqual(a, b interface{}) bool + func ContextQueryParams(c *APIContext) map[string][]string + func DeepCompare(a, b []map[string]interface{}) (bool, string) + func EndsWith(str string, endsWith string) (string, bool) + func EndsWithCheck(str string, endsWith string) bool + type API struct + ContentType string + func NewAPI(prefix string) *API + func NewAPIWithBaseURL(prefix string, baseURL string) *API + func NewAPIWithResolver(prefix string, resolver URLResolver) *API + func NewAPIWithRouting(prefix string, resolver URLResolver, router routing.Routeable) *API + func (api *API) AddResource(prototype jsonapi.MarshalIdentifier, source interface{}) + func (api *API) NewAPIVersion(prefix string) *API + func (api *API) SetContextAllocator(allocator APIContextAllocatorFunc) + func (api *API) UseMiddleware(middleware ...HandlerFunc) + func (api API) Handler() http.Handler + func (api API) Router() routing.Routeable + type APIContext struct + func (c *APIContext) Deadline() (deadline time.Time, ok bool) + func (c *APIContext) Done() <-chan struct{} + func (c *APIContext) Err() error + func (c *APIContext) Get(key string) (value interface{}, exists bool) + func (c *APIContext) Reset() + func (c *APIContext) Set(key string, value interface{}) + func (c *APIContext) Value(key interface{}) interface{} + type APIContextAllocatorFunc func(*API) APIContexter + type APIContexter interface + Get func(key string) (interface{}, bool) + Reset func() + Set func(key string, value interface{}) + type Api2GoModel struct + DeleteIncludes map[string][]string + Includes []jsonapi.MarshalIdentifier + func NewApi2GoModel(name string, columns []ColumnInfo, defaultPermission int64, ...) Api2GoModel + func NewApi2GoModelWithData(name string, columns []ColumnInfo, defaultPermission int64, ...) Api2GoModel + func (a *Api2GoModel) SetRelations(relations []TableRelation) + func (a Api2GoModel) GetColumnMap() map[string]ColumnInfo + func (a Api2GoModel) GetRelations() []TableRelation + func (a Api2GoModel) HasColumn(colName string) bool + func (a Api2GoModel) HasMany(colName string) bool + func (g *Api2GoModel) BeforeCreate() (err error) + func (g *Api2GoModel) Set(columnName string, value interface{}) + func (g *Api2GoModel) SetAttributes(attrs map[string]interface{}) + func (g *Api2GoModel) SetID(str string) error + func (g *Api2GoModel) SetType(typeName string) + func (g Api2GoModel) GetAuditModel() Api2GoModel + func (g Api2GoModel) GetChanges() map[string]Change + func (g Api2GoModel) GetColumnOriginalValue(columnName string) interface{} + func (g Api2GoModel) GetCurrentVersion() int64 + func (g Api2GoModel) GetDefaultPermission() int64 + func (g Api2GoModel) GetID() string + func (g Api2GoModel) GetName() string + func (g Api2GoModel) GetNextVersion() int64 + func (g Api2GoModel) GetReferenceId() string + func (g Api2GoModel) GetTableName() string + func (g Api2GoModel) GetUnmodifiedAttributes() map[string]interface{} + func (g Api2GoModel) HasVersion() bool + func (g Api2GoModel) IsDirty() bool + func (m *Api2GoModel) AddToManyIDs(name string, IDs []string) error + func (m *Api2GoModel) DeleteToManyIDs(name string, IDs []string) error + func (m *Api2GoModel) SetColumns(c []ColumnInfo) + func (m *Api2GoModel) SetToManyReferenceIDs(name string, IDs []map[string]interface{}) error + func (m *Api2GoModel) SetToOneReferenceID(name, ID string) error + func (m Api2GoModel) GetAllAsAttributes() map[string]interface{} + func (m Api2GoModel) GetAttributes() map[string]interface{} + func (m Api2GoModel) GetColumnNames() []string + func (m Api2GoModel) GetColumns() []ColumnInfo + func (m Api2GoModel) GetReferencedIDs() []jsonapi.ReferenceID + func (m Api2GoModel) GetReferencedStructs() []jsonapi.MarshalIdentifier + func (model Api2GoModel) GetReferences() []jsonapi.Reference + type CRUD interface + type Change struct + NewValue interface{} + OldValue interface{} + type ColumnInfo struct + ColumnDescription string + ColumnName string + ColumnType string + DataType string + DefaultValue string + ExcludeFromApi bool + ForeignKeyData ForeignKeyData + IsAutoIncrement bool + IsForeignKey bool + IsIndexed bool + IsNullable bool + IsPrimaryKey bool + IsUnique bool + Name string + Options []ValueOptions + Permission uint64 + type DeleteReferenceInfo struct + ReferenceId string + ReferenceRelationName string + type EditToManyRelations interface + AddToManyIDs func(name string, IDs []string) error + DeleteToManyIDs func(name string, IDs []string) error + type Error struct + Code string + Detail string + ID string + Links *ErrorLinks + Meta interface{} + Source *ErrorSource + Status string + Title string + type ErrorLinks struct + About string + type ErrorSource struct + Parameter string + Pointer string + type FindAll interface + FindAll func(req Request) (Responder, error) + type ForeignKeyData struct + DataSource string + KeyName string + Namespace string + func (f *ForeignKeyData) Scan(src interface{}) error + func (f ForeignKeyData) String() string + type HTTPError struct + Errors []Error + func NewHTTPError(err error, msg string, status int) HTTPError + func (e HTTPError) Error() string + func (e HTTPError) Status() int + type HandlerFunc func(APIContexter, http.ResponseWriter, *http.Request) + type HasId interface + GetId func() interface{} + type LinksResponder interface + Links func(*http.Request, string) jsonapi.Links + type ObjectInitializer interface + InitializeObject func(interface{}) + type PaginatedFindAll interface + PaginatedFindAll func(req Request) (totalCount uint, response Responder, err error) + type Pagination struct + CurrentPage uint64 + First map[string]string + From uint64 + Last map[string]string + LastPage uint64 + Next map[string]string + NextPageUrl string + PerPage uint64 + Prev map[string]string + PrevPageUrl string + To uint64 + Total uint64 + type Request struct + Context APIContexter + Header http.Header + Pagination map[string]string + PlainRequest *http.Request + QueryParams map[string][]string + type RequestAwareURLResolver interface + SetRequest func(http.Request) + type ResourceCreator interface + Create func(obj interface{}, req Request) (Responder, error) + type ResourceDeleter interface + Delete func(id string, req Request) (Responder, error) + type ResourceGetter interface + FindOne func(ID string, req Request) (Responder, error) + type ResourceUpdater interface + Update func(obj interface{}, req Request) (Responder, error) + type Responder interface + Metadata func() map[string]interface{} + Result func() interface{} + StatusCode func() int + type Response struct + Code int + Meta map[string]interface{} + Pagination Pagination + Res interface{} + func (r Response) Links(req *http.Request, baseURL string) (ret jsonapi.Links) + func (r Response) Metadata() map[string]interface{} + func (r Response) Result() interface{} + func (r Response) StatusCode() int + type TableRelation struct + Columns []ColumnInfo + Object string + ObjectName string + Relation string + Subject string + SubjectName string + func NewTableRelation(subject, relation, object string) TableRelation + func NewTableRelationWithNames(subject, subjectName, relation, object, objectName string) TableRelation + func (tr *TableRelation) GetJoinString() string + func (tr *TableRelation) GetJoinTableName() string + func (tr *TableRelation) GetObject() string + func (tr *TableRelation) GetObjectName() string + func (tr *TableRelation) GetRelation() string + func (tr *TableRelation) GetReverseJoinString() string + func (tr *TableRelation) GetSubject() string + func (tr *TableRelation) GetSubjectName() string + func (tr *TableRelation) Hash() string + func (tr *TableRelation) String() string + type TableRelationInterface interface + GetObjectName func() string + GetRelation func() string + GetSubjectName func() string + type URLResolver interface + GetBaseURL func() string + func NewCallbackResolver(callback func(http.Request) string) URLResolver + func NewStaticResolver(baseURL string) URLResolver + type ValueOptions struct + Label string + Value interface{} + ValueType string Other modules containing this package github.com/artpar/api2go