objects

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMetadata

type AppMetadata struct {
	Provider  string   `json:"provider,omitempty"`
	Providers []string `json:"providers,omitempty"`
	Role      []string `json:"role,omitempty"`
}

type Bucket

type Bucket struct {
	ID                string   `json:"id,omitempty"`
	Name              string   `json:"name,omitempty"`
	Owner             *string  `json:"owner,omitempty"`
	Public            bool     `json:"public"`
	AvifAutoDetection bool     `json:"avif_autodetection,omitempty"`
	FileSizeLimit     *int     `json:"file_size_limit"`
	AllowedMimeTypes  []string `json:"allowed_mime_types"`
	OwnerID           *string  `json:"owner_id,omitempty"`
}

type Column

type Column struct {
	TableID            int      `json:"table_id"`
	Schema             string   `json:"schema"`
	Table              string   `json:"table"`
	ID                 string   `json:"id"`
	OrdinalPosition    int      `json:"ordinal_position"`
	Name               string   `json:"name"`
	DefaultValue       any      `json:"default_value"`
	DataType           string   `json:"data_type"`
	Format             string   `json:"format"`
	IsIdentity         bool     `json:"is_identity"`
	IdentityGeneration any      `json:"identity_generation"`
	IsGenerated        bool     `json:"is_generated"`
	IsNullable         bool     `json:"is_nullable"`
	IsUpdatable        bool     `json:"is_updatable"`
	IsUnique           bool     `json:"is_unique"`
	Enums              []string `json:"enums"`

	// TODO : implement check and comment in models
	Check   any `json:"check"`
	Comment any `json:"comment"`
}

type Database

type Database struct {
	Host    string `json:"host"`
	Version string `json:"version"`
}

type Function

type Function struct {
	ID                     int           `json:"id"`
	Schema                 string        `json:"schema"`
	Name                   string        `json:"name"`
	Language               string        `json:"language"`
	Definition             string        `json:"definition"`
	CompleteStatement      string        `json:"complete_statement"`
	Args                   []FunctionArg `json:"args"`
	ArgumentTypes          string        `json:"argument_types"`
	IdentityArgumentTypes  string        `json:"identity_argument_types"`
	ReturnTypeID           int           `json:"return_type_id"`
	ReturnType             string        `json:"return_type"`
	ReturnTypeRelationID   int           `json:"return_type_relation_id"`
	IsSetReturningFunction bool          `json:"is_set_returning_function"`
	Behavior               string        `json:"behavior"`
	SecurityDefiner        bool          `json:"security_definer"`
	ConfigParams           any           `json:"config_params"`
}

type FunctionArg

type FunctionArg struct {
	Mode       string `json:"mode"`
	Name       string `json:"name"`
	TypeId     int    `json:"type_id"`
	HasDefault bool   `json:"has_default"`
}

type Identity

type Identity struct {
	IdentityID   string       `json:"identity_id,omitempty"`
	ID           string       `json:"id,omitempty"`
	UserID       string       `json:"user_id,omitempty"`
	IdentityData IdentityData `json:"identity_data,omitempty"`
	Provider     string       `json:"provider,omitempty"`
	LastSignInAt time.Time    `json:"last_sign_in_at,omitempty"`
	CreatedAt    time.Time    `json:"created_at,omitempty"`
	UpdatedAt    time.Time    `json:"updated_at,omitempty"`
	Email        string       `json:"email,omitempty"`
}

type IdentityData

type IdentityData struct {
	Email         string `json:"email,omitempty"`
	EmailVerified bool   `json:"email_verified,omitempty"`
	PhoneVerified bool   `json:"phone_verified,omitempty"`
	Sub           string `json:"sub,omitempty"`
}

type Policies

type Policies []Policy

func (*Policies) FilterByBucket

func (p *Policies) FilterByBucket(bucket Bucket) Policies

func (*Policies) FilterByTable

func (p *Policies) FilterByTable(table string) Policies

type Policy

type Policy struct {
	ID         int           `json:"id"`
	Schema     string        `json:"schema"`
	Table      string        `json:"table"`
	TableID    int           `json:"table_id"`
	Name       string        `json:"name"`
	Action     string        `json:"action"`
	Roles      []string      `json:"roles"`
	Command    PolicyCommand `json:"command"`
	Definition string        `json:"definition"`
	Check      *string       `json:"check"`
}

type PolicyCommand

type PolicyCommand string
const (
	PolicyCommandSelect PolicyCommand = "SELECT"
	PolicyCommandInsert PolicyCommand = "INSERT"
	PolicyCommandUpdate PolicyCommand = "UPDATE"
	PolicyCommandDelete PolicyCommand = "DELETE"
)

type PrimaryKey

type PrimaryKey struct {
	Name      string `json:"name"`
	Schema    string `json:"schema"`
	TableID   int    `json:"table_id"`
	TableName string `json:"table_name"`
}

type Project

type Project struct {
	Id             string    `json:"id"`
	OrganizationId string    `json:"organization_id"`
	Name           string    `json:"name"`
	Region         string    `json:"region"`
	CreatedAt      string    `json:"created_at"`
	Database       *Database `json:"database,omitempty"`
}

type ReplicaIdentity

type ReplicaIdentity string
const (
	ReplicaIdentityDefault ReplicaIdentity = "DEFAULT"
	ReplicaIdentityIndex   ReplicaIdentity = "INDEX"
)

type Role

type Role struct {
	ActiveConnections int            `json:"active_connections"`
	CanBypassRLS      bool           `json:"can_bypass_rls"`
	CanCreateDB       bool           `json:"can_create_db"`
	CanCreateRole     bool           `json:"can_create_role"`
	CanLogin          bool           `json:"can_login"`
	Config            map[string]any `json:"config"`
	ConnectionLimit   int            `json:"connection_limit"`
	ID                int            `json:"id"`
	InheritRole       bool           `json:"inherit_role"`
	IsReplicationRole bool           `json:"is_replication_role"`
	IsSuperuser       bool           `json:"is_superuser"`
	Name              string         `json:"name"`
	Password          string         `json:"password"`
	ValidUntil        *SupabaseTime  `json:"valid_until"`
}

type SupabaseTime

type SupabaseTime struct {
	time.Time
}

func NewSupabaseTime

func NewSupabaseTime(newTime time.Time) *SupabaseTime

func (SupabaseTime) MarshalJSON

func (mt SupabaseTime) MarshalJSON() ([]byte, error)

func (*SupabaseTime) UnmarshalJSON

func (mt *SupabaseTime) UnmarshalJSON(b []byte) error

type Table

type Table struct {
	Bytes            int                  `json:"bytes"`
	Columns          []Column             `json:"columns"`
	Comment          any                  `json:"comment"`
	DeadRowsEstimate int                  `json:"dead_rows_estimate"`
	ID               int                  `json:"id"`
	LiveRowsEstimate int                  `json:"live_rows_estimate"`
	Name             string               `json:"name"`
	PrimaryKeys      []PrimaryKey         `json:"primary_keys"`
	Relationships    []TablesRelationship `json:"relationships"`
	ReplicaIdentity  ReplicaIdentity      `json:"replica_identity"`
	RLSEnabled       bool                 `json:"rls_enabled"`
	RLSForced        bool                 `json:"rls_forced"`
	Schema           string               `json:"schema"`
	Size             string               `json:"size"`
}

type TablesRelationship

type TablesRelationship struct {
	Id                int32  `json:"id"`
	ConstraintName    string `json:"constraint_name"`
	SourceSchema      string `json:"source_schema"`
	SourceTableName   string `json:"source_table_name"`
	SourceColumnName  string `json:"source_column_name"`
	TargetTableSchema string `json:"target_table_schema"`
	TargetTableName   string `json:"target_table_name"`
	TargetColumnName  string `json:"target_column_name"`
}

type UpdateBucketParam

type UpdateBucketParam struct {
	OldData     Bucket
	ChangeItems []UpdateBucketType
}

type UpdateBucketType

type UpdateBucketType string
const (
	UpdateBucketIsPublic         UpdateBucketType = "is_public"
	UpdateBucketFileSizeLimit    UpdateBucketType = "file_size_limit"
	UpdateBucketAllowedMimeTypes UpdateBucketType = "allowed_mime_types"
)

type UpdateColumnItem

type UpdateColumnItem struct {
	Name        string
	UpdateItems []UpdateColumnType
}

type UpdateColumnType

type UpdateColumnType string
const (
	UpdateColumnNew          UpdateColumnType = "new"
	UpdateColumnDelete       UpdateColumnType = "delete"
	UpdateColumnName         UpdateColumnType = "name"
	UpdateColumnDefaultValue UpdateColumnType = "default_value"
	UpdateColumnDataType     UpdateColumnType = "data_type"
	UpdateColumnUnique       UpdateColumnType = "unique"
	UpdateColumnNullable     UpdateColumnType = "nullable"
	UpdateColumnIdentity     UpdateColumnType = "identity"
)

type UpdatePolicyParam

type UpdatePolicyParam struct {
	Name        string
	ChangeItems []UpdatePolicyType
}

type UpdatePolicyType

type UpdatePolicyType string
const (
	UpdatePolicyName       UpdatePolicyType = "name"
	UpdatePolicyDefinition UpdatePolicyType = "definition"
	UpdatePolicyCheck      UpdatePolicyType = "check"
	UpdatePolicyRoles      UpdatePolicyType = "roles"
)

type UpdateRelationItem

type UpdateRelationItem struct {
	Data TablesRelationship
	Type UpdateRelationType
}

type UpdateRelationType

type UpdateRelationType string
const (
	UpdateRelationCreate UpdateRelationType = "create"
	UpdateRelationUpdate UpdateRelationType = "update"
	UpdateRelationDelete UpdateRelationType = "delete"
)

type UpdateRoleParam

type UpdateRoleParam struct {
	OldData     Role
	ChangeItems []UpdateRoleType
}

type UpdateRoleType

type UpdateRoleType string
const (
	UpdateConnectionLimit   UpdateRoleType = "connection_limit"
	UpdateRoleName          UpdateRoleType = "name"
	UpdateRoleIsReplication UpdateRoleType = "is_replication"
	UpdateRoleIsSuperUser   UpdateRoleType = "is_superuser"
	UpdateRoleInheritRole   UpdateRoleType = "inherit_role"
	UpdateRoleCanCreateDb   UpdateRoleType = "can_create_db"
	UpdateRoleCanCreateRole UpdateRoleType = "can_create_role"
	UpdateRoleCanLogin      UpdateRoleType = "can_login"
	UpdateRoleCanBypassRls  UpdateRoleType = "can_bypass_rls"
	UpdateRoleConfig        UpdateRoleType = "config"
	UpdateRoleValidUntil    UpdateRoleType = "valid_until"
)

type UpdateTableParam

type UpdateTableParam struct {
	OldData             Table
	ChangeRelationItems []UpdateRelationItem
	ChangeColumnItems   []UpdateColumnItem
	ChangeItems         []UpdateTableType
	ForceCreateRelation bool
}

type UpdateTableType

type UpdateTableType string

---- update table struct definitions ----

const (
	UpdateTableSchema          UpdateTableType = "schema"
	UpdateTableName            UpdateTableType = "name"
	UpdateTableRlsEnable       UpdateTableType = "rls_enable"
	UpdateTableRlsForced       UpdateTableType = "rls_forced"
	UpdateTablePrimaryKey      UpdateTableType = "primary_key"
	UpdateTableReplicaIdentity UpdateTableType = "replica_identity"
)

type User

type User struct {
	ID               string      `json:"id,omitempty"`
	Aud              string      `json:"aud,omitempty"`
	Role             string      `json:"role,omitempty"`
	Email            string      `json:"email,omitempty"`
	EmailConfirmedAt time.Time   `json:"email_confirmed_at,omitempty"`
	Phone            string      `json:"phone,omitempty"`
	ConfirmedAt      time.Time   `json:"confirmed_at,omitempty"`
	LastSignInAt     time.Time   `json:"last_sign_in_at,omitempty"`
	AppMetadata      AppMetadata `json:"app_metadata,omitempty"`
	UserMetadata     interface{} `json:"user_metadata,omitempty"`
	Identities       []Identity  `json:"identities,omitempty"`
	CreatedAt        time.Time   `json:"created_at,omitempty"`
	UpdatedAt        time.Time   `json:"updated_at,omitempty"`
	IsAnonymous      bool        `json:"is_anonymous,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL