models

package
v0.0.0-...-3e4397d Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package models is made to store the structs of different data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICollection

type APICollection struct {
	Authenticated   LinksCollection `json:"authenticated" swaggertype:"object"`
	UnAuthenticated LinksCollection `json:"unAuthenticated" swaggertype:"object"`
}

APICollection is the object that lists which apis require authentication and which do not

type APICollectionResponse

type APICollectionResponse struct {
	Status int           `json:"status" example:"200"`
	Data   APICollection `json:"data"`
}

APICollectionResponse represents the response format for api collection data.

type Api

type Api struct {
	Href          string `json:"href" example:"/api/v1/licenses"`
	RequestMethod string `json:"request_method" enums:"POST,PATCH,DELETE,PUT,GET" example:"POST"`
}

Api contains the information about an endpoint

type Audit

type Audit struct {
	Id         int64       `json:"id" gorm:"primary_key;column:id" example:"456"`
	UserId     int64       `json:"user_id" gorm:"column:user_id" example:"123"`
	User       User        `gorm:"foreignKey:UserId;references:Id" json:"user"`
	Timestamp  time.Time   `json:"timestamp" gorm:"column:timestamp" example:"2023-12-01T18:10:25.00+05:30"`
	Type       string      `json:"type" gorm:"column:type" enums:"obligation,license" example:"license"`
	TypeId     int64       `json:"type_id" gorm:"column:type_id" example:"34"`
	Entity     interface{} `json:"entity" gorm:"-" swaggertype:"object"`
	ChangeLogs []ChangeLog `json:"-"`
}

Audit struct represents an audit entity with certain attributes and properties It has user id as a foreign key

func (Audit) TableName

func (Audit) TableName() string

type AuditResponse

type AuditResponse struct {
	Status int             `json:"status" example:"200"`
	Data   []Audit         `json:"data"`
	Meta   *PaginationMeta `json:"paginationmeta"`
}

AuditResponse represents the response format for audit data.

type CategoryObligationCount

type CategoryObligationCount struct {
	Category string `json:"category" example:"GENERAL"`
	Count    int64  `json:"count" example:"6"`
}

type ChangeLog

type ChangeLog struct {
	Id           int64   `json:"id" gorm:"primary_key" example:"789"`
	Field        string  `json:"field" example:"text"`
	UpdatedValue *string `json:"updated_value" example:"New license text"`
	OldValue     *string `json:"old_value" example:"Old license text"`
	AuditId      int64   `json:"audit_id" example:"456"`
	Audit        Audit   `gorm:"foreignKey:AuditId;references:Id" json:"-"`
}

ChangeLog struct represents a change entity with certain attributes and properties

func (ChangeLog) TableName

func (ChangeLog) TableName() string

type ChangeLogResponse

type ChangeLogResponse struct {
	Status int            `json:"status" example:"200"`
	Data   []ChangeLog    `json:"data"`
	Meta   PaginationMeta `json:"paginationmeta"`
}

ChangeLogResponse represents the design of API response of change log

type ContextKey

type ContextKey string

type Dashboard

type Dashboard struct {
	LicensesCount                int64                     `json:"licenses_count" example:"2"`
	ObligationsCount             int64                     `json:"obligations_count" example:"7"`
	UsersCount                   int64                     `json:"users_count" example:"5"`
	LicenseChangesSinceLastMonth int64                     `json:"monthly_license_changes_count" example:"6"`
	RiskLicenseFrequency         []RiskLicenseCount        `json:"risk_license_frequency"`
	CategoryObligationFrequency  []CategoryObligationCount `json:"category_obligation_frequency"`
}

type DashboardResponse

type DashboardResponse struct {
	Status int       `json:"status" example:"200"`
	Data   Dashboard `json:"data"`
}

type ImportLicensesResponse

type ImportLicensesResponse struct {
	Status int           `json:"status" example:"200"`
	Data   []interface{} `json:"data"` // can be of type models.LicenseError or models.LicenseImportStatus
}

ImportObligationsResponse is the response structure for import obligation response

type ImportObligationsResponse

type ImportObligationsResponse struct {
	Status int           `json:"status" example:"200"`
	Data   []interface{} `json:"data"` // can be of type models.LicenseError or models.ObligationImportStatus
}

ImportObligationsResponse is the response structure for import obligation response

type LicenseDB

type LicenseDB struct {
	Id              int64                                        `json:"-" gorm:"primary_key;column:rf_id" example:"123"`
	Shortname       *string                                      `json:"shortname" gorm:"column:rf_shortname" validate:"required" example:"MIT"`
	Fullname        *string                                      `json:"fullname" gorm:"column:rf_fullname" validate:"required" example:"MIT License"`
	Text            *string                                      `json:"text" gorm:"column:rf_text" validate:"required" example:"MIT License Text here"`
	Url             *string                                      `json:"url" gorm:"column:rf_url;default:''" example:"https://opensource.org/licenses/MIT"`
	AddDate         time.Time                                    `json:"add_date" gorm:"column:rf_add_date" example:"2023-12-01T18:10:25.00+05:30"`
	Copyleft        *bool                                        `json:"copyleft" gorm:"column:rf_copyleft;default:false"`
	FSFfree         *bool                                        `json:"FSFfree" gorm:"column:rf_fsffree;default:false"`
	OSIapproved     *bool                                        `json:"OSIapproved" gorm:"column:rf_osiapproved;default:false"`
	GPLv2compatible *bool                                        `json:"GPLv2compatible" gorm:"column:rf_gplv2compatible;default:false"`
	GPLv3compatible *bool                                        `json:"GPLv3compatible" gorm:"column:rf_gplv3compatible;default:false"`
	Notes           *string                                      `json:"notes" gorm:"column:rf_notes" example:"This license has been superseded."`
	Fedora          *string                                      `json:"Fedora" gorm:"column:rf_fedora"`
	TextUpdatable   *bool                                        `json:"text_updatable" gorm:"column:rf_text_updatable;default:false"`
	DetectorType    *int64                                       `json:"detector_type" gorm:"column:rf_detector_type" validate:"omitempty,min=0,max=2" example:"1"`
	Active          *bool                                        `json:"active" gorm:"column:rf_active;default:true"`
	Source          *string                                      `json:"source" gorm:"column:rf_source"`
	SpdxId          *string                                      `json:"spdx_id" gorm:"column:rf_spdx_id" validate:"required" example:"MIT"`
	Risk            *int64                                       `json:"risk" gorm:"column:rf_risk" validate:"omitempty,min=0,max=5"`
	Flag            *int64                                       `json:"flag" gorm:"column:rf_flag" validate:"omitempty,min=0,max=2" example:"1"`
	Marydone        *bool                                        `json:"marydone" gorm:"column:marydone;default:false"`
	ExternalRef     datatypes.JSONType[LicenseDBSchemaExtension] `json:"external_ref" gorm:"column:external_ref"`
	Obligations     []*Obligation                                `gorm:"many2many:obligation_licenses;joinForeignKey:license_db_id ;joinReferences: obligation_id" json:"-"`
	UserId          int64                                        `json:"-" example:"123"`                                   // Foreign key to User
	User            User                                         `gorm:"foreignKey:UserId;references:Id" json:"created_by"` // Reference to User
}

The LicenseDB struct represents a license entity with various attributes and properties associated with it. It provides structured storage for license-related information.

func (*LicenseDB) BeforeCreate

func (l *LicenseDB) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate hook to validate data and log the user who is creating the record

func (*LicenseDB) BeforeUpdate

func (l *LicenseDB) BeforeUpdate(tx *gorm.DB) (err error)

BeforeUpdate hook to validate data and log the user who is updating the record

func (LicenseDB) TableName

func (LicenseDB) TableName() string

type LicenseError

type LicenseError struct {
	Status    int    `json:"status" example:"400"`
	Message   string `json:"message" example:"invalid request body"`
	Error     string `json:"error" example:"invalid request body"`
	Path      string `json:"path" example:"/api/v1/licenses"`
	Timestamp string `json:"timestamp" example:"2023-12-01T10:00:51+05:30"`
}

The LicenseError struct represents an error response related to license operations. It provides information about the encountered error, including details such as status, error message, error type, path, and timestamp.

type LicenseId

type LicenseId struct {
	Shortname string `json:"shortname" example:"MIT"`
}

LicenseId is the id of successfully imported license

type LicenseImportStatus

type LicenseImportStatus struct {
	Status int       `json:"status" example:"200"`
	Data   LicenseId `json:"data"`
}

LicenseImportStatus is the status of license records successfully inserted in the database during import

type LicenseJson

type LicenseJson struct {
	Shortname       string `json:"rf_shortname"`
	Fullname        string `json:"rf_fullname"`
	Text            string `json:"rf_text"`
	Url             string `json:"rf_url"`
	AddDate         string `json:"rf_add_date"`
	Copyleft        string `json:"rf_copyleft"`
	FSFfree         string `json:"rf_FSFfree"`
	OSIapproved     string `json:"rf_OSIapproved"`
	GPLv2compatible string `json:"rf_GPLv2compatible"`
	GPLv3compatible string `json:"rf_GPLv3compatible"`
	Notes           string `json:"rf_notes"`
	Fedora          string `json:"rf_Fedora"`
	TextUpdatable   string `json:"rf_text_updatable"`
	DetectorType    int64  `json:"rf_detector_type"`
	Active          string `json:"rf_active"`
	Source          string `json:"rf_source"`
	SpdxCompatible  string `json:"rf_spdx_compatible"`
	Risk            string `json:"rf_risk"`
	Flag            string `json:"rf_flag"`
	Marydone        string `json:"marydone"`
}

type LicenseMapShortnamesElement

type LicenseMapShortnamesElement struct {
	Shortname string `json:"shortname" example:"GPL-2.0-only"`
	Add       bool   `json:"add" example:"true"`
}

LicenseMapShortnamesElement Element to hold license shortname and action

type LicenseMapShortnamesInput

type LicenseMapShortnamesInput struct {
	MapInput []LicenseMapShortnamesElement `json:"map"`
}

LicenseMapShortnamesInput List of elements to be read as input by API

type LicensePreviewResponse

type LicensePreviewResponse struct {
	Status     int      `json:"status" example:"200"`
	Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"`
}

LicensePreviewResponse gets us the list of all license shortnames

type LicenseResponse

type LicenseResponse struct {
	Status int             `json:"status" example:"200"`
	Data   []LicenseDB     `json:"data"`
	Meta   *PaginationMeta `json:"paginationmeta"`
}

LicenseResponse struct is representation of design API response of license. The LicenseResponse struct represents the response data structure for retrieving license information. It is used to encapsulate license-related data in an organized manner.

type LicenseShortnamesInput

type LicenseShortnamesInput struct {
	Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"`
}

LicenseShortnamesInput represents the input format for adding/removing licenses from obligation map.

type LicenseUpdateJSONSchema

type LicenseUpdateJSONSchema struct {
	Id              int64                                        `json:"-" example:"123"`
	Shortname       *string                                      `json:"-" example:"MIT"`
	Fullname        *string                                      `json:"fullname" example:"MIT License"`
	Text            *string                                      `json:"text" example:"MIT License Text here"`
	Url             *string                                      `json:"url" example:"https://opensource.org/licenses/MIT"`
	AddDate         time.Time                                    `json:"-" example:"2023-12-01T18:10:25.00+05:30"`
	Copyleft        *bool                                        `json:"copyleft" example:"false"`
	FSFfree         *bool                                        `json:"FSFfree" example:"false"`
	OSIapproved     *bool                                        `json:"OSIapproved" example:"false"`
	GPLv2compatible *bool                                        `json:"GPLv2compatible" example:"false"`
	GPLv3compatible *bool                                        `json:"GPLv3compatible" example:"false"`
	Notes           *string                                      `json:"notes" example:"This license has been superseded."`
	Fedora          *string                                      `json:"Fedora" example:"Fedora"`
	TextUpdatable   *bool                                        `json:"text_updatable" example:"false"`
	DetectorType    *int64                                       `json:"detector_type" validate:"omitempty,min=0,max=2" example:"1"`
	Active          *bool                                        `json:"active" example:"true"`
	Source          *string                                      `json:"source" example:"Source"`
	SpdxId          *string                                      `json:"spdx_id" example:"MIT"`
	Risk            *int64                                       `json:"risk" validate:"omitempty,min=0,max=5" example:"1"`
	Flag            *int64                                       `json:"flag" validate:"omitempty,min=0,max=2" example:"1"`
	Marydone        *bool                                        `json:"marydone" example:"false"`
	ExternalRef     datatypes.JSONType[LicenseDBSchemaExtension] `json:"external_ref"`
	Obligations     []*Obligation                                `json:"obligations"`
	UserId          int64                                        `json:"-" example:"123"` // Foreign key to User
	User            User                                         `json:"-"`               // Reference to User
}

LicenseUpdateJSONSchema struct represents the input format for updating an existing license.

type LinksCollection

type LinksCollection struct {
	Links map[string]Api `json:"_links" swaggertype:"object,string" example:"licenses:{}"`
}

LinksCollection is a collection of links

type Obligation

type Obligation struct {
	Id                         int64                     `gorm:"primary_key;column:id" `
	Topic                      *string                   `gorm:"column:topic"`
	Text                       *string                   `gorm:"column:text"`
	Modifications              *bool                     `gorm:"column:modifications;default:false"`
	Comment                    *string                   `gorm:"column:comment"`
	Active                     *bool                     `gorm:"column:active;default:true"`
	TextUpdatable              *bool                     `gorm:"column:text_updatable;default:false" `
	Md5                        string                    `gorm:"column:md5"`
	ObligationClassificationId int64                     `gorm:"column:obligation_classification_id"`
	ObligationTypeId           int64                     `gorm:"column:obligation_type_id"`
	Licenses                   []*LicenseDB              `gorm:"many2many:obligation_licenses; joinForeignKey:obligation_id;joinReferences: license_db_id "`
	Type                       *ObligationType           `gorm:"foreignKey:ObligationTypeId; references:Id"`
	Classification             *ObligationClassification `gorm:"foreignKey:ObligationClassificationId ;references:Id"`
	Category                   *string                   `` /* 133-byte string literal not displayed */
}

Obligation represents an obligation record in the database.

func (*Obligation) BeforeCreate

func (o *Obligation) BeforeCreate(tx *gorm.DB) (err error)

func (*Obligation) BeforeUpdate

func (o *Obligation) BeforeUpdate(tx *gorm.DB) (err error)

func (*Obligation) MarshalJSON

func (o *Obligation) MarshalJSON() ([]byte, error)

Custom json marshaller and unmarshaller for Obligation

func (Obligation) TableName

func (Obligation) TableName() string

func (*Obligation) UnmarshalJSON

func (o *Obligation) UnmarshalJSON(data []byte) error

Custom JSON unmarshaller for Obligation

type ObligationClassification

type ObligationClassification struct {
	Id             int64  `gorm:"primary_key column:id" json:"-"`
	Classification string `gorm:"column:classification" validate:"required,uppercase" example:"GREEN" json:"classification"`
	Color          string `gorm:"column:color" validate:"required,hexcolor" example:"#00FF00" json:"color"`
	Active         *bool  `gorm:"column:active;default:true" json:"-"`
}

ObligationClassification represents one of the possible of obligation classification values

func (ObligationClassification) TableName

func (ObligationClassification) TableName() string

type ObligationClassificationResponse

type ObligationClassificationResponse struct {
	Status int                        `json:"status" example:"200"`
	Data   []ObligationClassification `json:"data"`
	Meta   *PaginationMeta            `json:"paginationmeta"`
}

ObligationClassificationResponse represents the response format for obligation classification data.

type ObligationDTO

type ObligationDTO struct {
	Topic          *string  `json:"topic" example:"copyleft" validate:"required"`
	Type           *string  `json:"type" example:"RISK" validate:"required"`
	Text           *string  `json:"text" example:"Source code be made available when distributing the software." validate:"required"`
	Classification *string  `json:"classification" example:"GREEN" validate:"required"`
	Modifications  *bool    `json:"modifications" example:"true"`
	Comment        *string  `json:"comment"`
	Active         *bool    `json:"active"`
	TextUpdatable  *bool    `json:"text_updatable" example:"true"`
	Shortnames     []string `json:"shortnames" validate:"required" example:"GPL-2.0-only,GPL-2.0-or-later"`
	Category       *string  `json:"category" example:"DISTRIBUTION" validate:"required"`
}

ObligationDTO represents an obligation json object.

type ObligationId

type ObligationId struct {
	Id    int64  `json:"id" example:"31"`
	Topic string `json:"topic" example:"copyleft"`
}

ObligationId is the id of successfully imported obligation

type ObligationImportRequest

type ObligationImportRequest struct {
	ObligationFile string `form:"file"`
}

ObligationImportRequest represents the request body structure for import obligation

type ObligationImportStatus

type ObligationImportStatus struct {
	Status  int          `json:"status" example:"200"`
	Data    ObligationId `json:"data"`
	Message string       `json:"message"`
}

ObligationImportStatus is the status of obligation records successfully inserted in the database during import

type ObligationMapResponse

type ObligationMapResponse struct {
	Status int                 `json:"status" example:"200"`
	Data   []ObligationMapUser `json:"data"`
	Meta   PaginationMeta      `json:"paginationmeta"`
}

ObligationMapResponse response format for obligation map data.

type ObligationMapUser

type ObligationMapUser struct {
	Topic      string   `json:"topic" example:"copyleft"`
	Type       string   `json:"type" example:"obligation" enums:"obligation,restriction,risk,right"`
	Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"`
}

ObligationMapUser Structure with obligation topic and license shortname list, a simple representation for user.

type ObligationPreview

type ObligationPreview struct {
	Topic string `json:"topic" example:"Provide Copyright Notices"`
	Type  string `json:"type" enums:"obligation,restriction,risk,right"`
}

ObligationPreview is just the Type and Topic of Obligation

type ObligationPreviewResponse

type ObligationPreviewResponse struct {
	Status int                 `json:"status" example:"200"`
	Data   []ObligationPreview `json:"data"`
}

ObligationResponse represents the response format for obligation data.

type ObligationResponse

type ObligationResponse struct {
	Status int             `json:"status" example:"200"`
	Data   []Obligation    `json:"data"`
	Meta   *PaginationMeta `json:"paginationmeta"`
}

ObligationResponse represents the response format for obligation data.

type ObligationType

type ObligationType struct {
	Id     int64  `gorm:"primary_key column:id" json:"-"`
	Type   string `gorm:"column:type" validate:"required,uppercase" example:"PERMISSION" json:"type"`
	Active *bool  `gorm:"column:active;default:true" json:"-"`
}

ObligationType represents one of the possible of obligation type values

func (ObligationType) TableName

func (ObligationType) TableName() string

type ObligationTypeResponse

type ObligationTypeResponse struct {
	Status int              `json:"status" example:"200"`
	Data   []ObligationType `json:"data"`
	Meta   *PaginationMeta  `json:"paginationmeta"`
}

ObligationTypeResponse represents the response format for obligation type data.

type ObligationUpdateDTO

type ObligationUpdateDTO struct {
	Topic          *string `json:"-" example:"copyleft"`
	Type           *string `json:"type" example:"RISK"`
	Text           *string `json:"text" example:"Source code be made available when distributing the software."`
	Classification *string `json:"classification" example:"GREEN"`
	Modifications  *bool   `json:"modifications" example:"true"`
	Comment        *string `json:"comment"`
	Active         *bool   `json:"active"`
	TextUpdatable  *bool   `json:"text_updatable" example:"true"`
	Category       *string `json:"category" example:"DISTRIBUTION"`
}

ObligationUpdateDTO represents an obligation json object.

func (*ObligationUpdateDTO) Converter

func (obDto *ObligationUpdateDTO) Converter() *Obligation

type PaginationInput

type PaginationInput struct {
	Page  int64 `json:"page" example:"10"`
	Limit int64 `json:"limit" example:"10"`
}

The PaginationInput struct represents the input required for pagination.

func (PaginationInput) GetLimit

func (p PaginationInput) GetLimit() int64

GetLimit returns the limit value for gorm.

func (PaginationInput) GetOffset

func (p PaginationInput) GetOffset() int64

GetOffset returns the offset value for gorm.

type PaginationMeta

type PaginationMeta struct {
	ResourceCount int    `json:"resource_count" example:"200"`
	TotalPages    int64  `json:"total_pages,omitempty" example:"20"`
	Page          int64  `json:"page,omitempty" example:"10"`
	Limit         int64  `json:"limit,omitempty" example:"10"`
	Next          string `json:"next,omitempty" example:"/api/v1/licenses?limit=10&page=11"`
	Previous      string `json:"previous,omitempty" example:"/api/v1/licenses?limit=10&page=9"`
}

The PaginationMeta struct represents additional metadata associated with a license retrieval operation. It contains information that provides context and supplementary details about the retrieved license data.

type PaginationParse

type PaginationParse interface {
	GetOffset() int
	GetLimit() int
}

PaginationParse interface processes the pagination input.

type ProfileUpdate

type ProfileUpdate struct {
	Id           int64   `json:"-"`
	UserName     *string `json:"-"`
	DisplayName  *string `json:"display_name" example:"fossy"`
	UserEmail    *string `json:"user_email" validate:"omitempty,email"`
	UserLevel    *string `json:"-"`
	UserPassword *string `json:"user_password"`
	Active       *bool   `json:"-"`
}

type RiskLicenseCount

type RiskLicenseCount struct {
	Risk  int64 `json:"risk" example:"2"`
	Count int64 `json:"count" example:"6"`
}

type SearchLicense

type SearchLicense struct {
	Field      string `json:"field" binding:"required" example:"text"`
	SearchTerm string `json:"search_term" binding:"required" example:"MIT License"`
	Search     string `json:"search" enums:"fuzzy,full_text_search"`
}

SearchLicense struct represents the input needed to search in a license.

type SwaggerDocAPISecurityScheme

type SwaggerDocAPISecurityScheme struct {
	BasePath string `json:"basePath" example:"/api/v1"`
	Paths    map[string]map[string]struct {
		Security    []map[string]interface{} `json:"security" swaggertype:"array,object"`
		OperationId string                   `json:"operationId" example:"GetLicense"`
	} `json:"paths"`
}

SwaggerDocAPISecurityScheme is the json schema describing info about various apis

type SwaggerObligationResponse

type SwaggerObligationResponse struct {
	Status int             `json:"status" example:"200"`
	Data   []ObligationDTO `json:"data"`
	Meta   *PaginationMeta `json:"paginationmeta"`
}

SwaggerObligationResponse represents the response format for obligation data.

type UpdateExternalRefsJSONPayload

type UpdateExternalRefsJSONPayload struct {
	ExternalRef map[string]interface{} `json:"external_ref"`
}

UpdateExternalRefsJSONPayload struct represents the external ref key value pairs for update

type User

type User struct {
	Id           int64   `json:"id" gorm:"primary_key;column:id" example:"123"`
	UserName     *string `json:"user_name" gorm:"column:user_name" example:"fossy"`
	DisplayName  *string `json:"display_name" gorm:"column:display_name" example:"fossy"`
	UserEmail    *string `json:"user_email" gorm:"column:user_email" example:"fossy@org.com"`
	UserLevel    *string `json:"user_level" gorm:"column:user_level" example:"USER"`
	UserPassword *string `json:"-" gorm:"column:user_password"`
	Active       *bool   `json:"-" gorm:"column:active;default:true"`
}

User struct is representation of user information.

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) (err error)

func (*User) BeforeUpdate

func (u *User) BeforeUpdate(tx *gorm.DB) (err error)

func (User) TableName

func (User) TableName() string

type UserCreate

type UserCreate struct {
	Id           int64   `json:"-"`
	UserName     *string `json:"user_name" validate:"required" example:"fossy"`
	DisplayName  *string `json:"display_name" validate:"required" example:"fossy"`
	UserEmail    *string `json:"user_email" validate:"required,email" example:"fossy@org.com"`
	UserLevel    *string `json:"user_level" validate:"required,oneof=USER ADMIN" example:"ADMIN"`
	UserPassword *string `json:"user_password" example:"fossy"`
	Active       *bool   `json:"-"`
}

type UserLogin

type UserLogin struct {
	Username     string `json:"username" binding:"required" example:"fossy"`
	Userpassword string `json:"password" binding:"required" example:"fossy"`
}

type UserResponse

type UserResponse struct {
	Status int             `json:"status" example:"200"`
	Data   []User          `json:"data"`
	Meta   *PaginationMeta `json:"paginationmeta"`
}

UserResponse struct is representation of design API response of user.

type UserUpdate

type UserUpdate struct {
	Id           int64   `json:"-"`
	UserName     *string `json:"user_name" example:"fossy"`
	DisplayName  *string `json:"display_name" example:"fossy"`
	UserEmail    *string `json:"user_email" validate:"omitempty,email"`
	UserLevel    *string `json:"user_level" validate:"omitempty,oneof=USER ADMIN" example:"ADMIN"`
	UserPassword *string `json:"user_password"`
	Active       *bool   `json:"active"`
}

Jump to

Keyboard shortcuts

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